]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
random: wire up fops->splice_{read,write}_iter()
authorJens Axboe <axboe@kernel.dk>
Thu, 19 May 2022 23:31:37 +0000 (17:31 -0600)
committerStefan Bader <stefan.bader@canonical.com>
Wed, 10 Aug 2022 07:23:15 +0000 (09:23 +0200)
BugLink: https://bugs.launchpad.net/bugs/1981649
commit 79025e727a846be6fd215ae9cdb654368ac3f9a6 upstream.

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

Fixes: 36e2c7421f02 ("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>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
drivers/char/random.c

index e950f2f28e3d36e318a6971589c0e117b590c947..5ac332978c3028e53f62b4dca2dfad302a1535b4 100644 (file)
@@ -1386,6 +1386,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 = {
@@ -1395,6 +1397,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,
 };