Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

splice: remove permission hook from do_splice_direct()

All callers of do_splice_direct() have a call to rw_verify_area() for
the entire range that is being copied, e.g. by vfs_copy_file_range() or
do_sendfile() before calling do_splice_direct().

The rw_verify_area() check inside do_splice_direct() is redundant and
is called after sb_start_write(), so it is not "start-write-safe".
Remove this redundant check.

This is needed for fanotify "pre content" events.

Reviewed-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Link: https://lore.kernel.org/r/20231122122715.2561213-3-amir73il@gmail.com
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Jan Kara <jack@suse.cz>
Signed-off-by: Christian Brauner <brauner@kernel.org>

authored by

Amir Goldstein and committed by
Christian Brauner
2a33e2dd ca7ab482

+1 -4
+1 -4
fs/splice.c
··· 1166 1166 * (splice in + splice out, as compared to just sendfile()). So this helper 1167 1167 * can splice directly through a process-private pipe. 1168 1168 * 1169 + * Callers already called rw_verify_area() on the entire range. 1169 1170 */ 1170 1171 long do_splice_direct(struct file *in, loff_t *ppos, struct file *out, 1171 1172 loff_t *opos, size_t len, unsigned int flags) ··· 1187 1186 1188 1187 if (unlikely(out->f_flags & O_APPEND)) 1189 1188 return -EINVAL; 1190 - 1191 - ret = rw_verify_area(WRITE, out, opos, len); 1192 - if (unlikely(ret < 0)) 1193 - return ret; 1194 1189 1195 1190 ret = splice_direct_to_actor(in, &sd, direct_splice_actor); 1196 1191 if (ret > 0)