Patch "vfs: deny copy_file_range() for non regular files" has been added to the 4.9-stable tree
Subsystems (2)
This is a note to let you know that I've just added the patch titled
vfs: deny copy_file_range() for non regular files
to the 4.9-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
vfs-deny-copy_file_range-for-non-regular-files.patch
and it can be found in the queue-4.9 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
Quoted 1 line
From
11cbfb10775aa2a01cee966d118049ede9d0bdf2Mon Sep 17 00:00:00 2001
From: Amir Goldstein <[email protected]>
Date: Tue, 31 Jan 2017 10:34:56 +0200
Subject: vfs: deny copy_file_range() for non regular files
From: Amir Goldstein <[email protected]>
commit 11cbfb10775aa2a01cee966d118049ede9d0bdf2 upstream.
There is no in-tree file system that implements copy_file_range() for non regular files.
Deny an attempt to copy_file_range() a directory with EISDIR and any other non regualr file with EINVAL to conform with behavior of vfs_{clone,dedup}_file_range().
This change is needed prior to converting sb_start_write() to file_start_write() in the vfs helper.
--- fs/read_write.c | 5 +++++ 1 file changed, 5 insertions(+)
fs/read_write.c +5 -0
@@ -1518,6 +1518,11 @@ ssize_t vfs_copy_file_range(struct fileif (flags !=0 )return -EINVAL ; +if (S_ISDIR (inode_in->i_mode) ||S_ISDIR (inode_out->i_mode)) +return -EISDIR ; +if (!S_ISREG (inode_in->i_mode) || !S_ISREG (inode_out->i_mode)) +return -EINVAL ; + ret =rw_verify_area (READ , file_in, &pos_in, len);if (unlikely (ret))return ret;
Patches currently in stable-queue which might be from [email protected] are
queue-4.9/vfs-deny-copy_file_range-for-non-regular-files.patch