Skip to content

Commit

Permalink
random: wire up fops->splice_{read,write}_iter()
Browse files Browse the repository at this point in the history
commit 79025e7 upstream.

Now that random/urandom is using {read,write}_iter, we can wire it up to
using the generic splice handlers.

Fixes: 36e2c74 ("fs: don't allow splice read/write without explicit ops")
Signed-off-by: Jens Axboe <axboe@kernel.dk>
[Jason: added the splice_write path. Note that sendfile() and such still
 does not work for read, though it does for write, because of a file
 type restriction in splice_direct_to_actor(), which I'll address
 separately.]
Cc: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
axboe authored and gregkh committed May 30, 2022
1 parent fdb1b35 commit 08467db
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions drivers/char/random.c
Original file line number Diff line number Diff line change
Expand Up @@ -1429,6 +1429,8 @@ const struct file_operations random_fops = {
.compat_ioctl = compat_ptr_ioctl,
.fasync = random_fasync,
.llseek = noop_llseek,
.splice_read = generic_file_splice_read,
.splice_write = iter_file_splice_write,
};

const struct file_operations urandom_fops = {
Expand All @@ -1438,6 +1440,8 @@ const struct file_operations urandom_fops = {
.compat_ioctl = compat_ptr_ioctl,
.fasync = random_fasync,
.llseek = noop_llseek,
.splice_read = generic_file_splice_read,
.splice_write = iter_file_splice_write,
};


Expand Down

0 comments on commit 08467db

Please sign in to comment.