]> git.baikalelectronics.ru Git - kernel.git/commit
vfs: move permission checking into notify_change() for utimes(NULL)
authorMiklos Szeredi <mszeredi@redhat.com>
Fri, 16 Sep 2016 10:44:20 +0000 (12:44 +0200)
committerMiklos Szeredi <mszeredi@redhat.com>
Fri, 16 Sep 2016 10:44:20 +0000 (12:44 +0200)
commitf4c051ef9ddc795887bfc9c15f0ba450a5957bf9
treeb4bea4c83e1968a4f69592e9a7fc15be81750a8c
parentb9179e5f0363f733bade04620eea20e5cb153bf4
vfs: move permission checking into notify_change() for utimes(NULL)

This fixes a bug where the permission was not properly checked in
overlayfs.  The testcase is ltp/utimensat01.

It is also cleaner and safer to do the permission checking in the vfs
helper instead of the caller.

This patch introduces an additional ia_valid flag ATTR_TOUCH (since
touch(1) is the most obvious user of utimes(NULL)) that is passed into
notify_change whenever the conditions for this special permission checking
mode are met.

Reported-by: Aihua Zhang <zhangaihua1@huawei.com>
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Tested-by: Aihua Zhang <zhangaihua1@huawei.com>
Cc: <stable@vger.kernel.org> # v3.18+
fs/attr.c
fs/utimes.c
include/linux/fs.h