ovl: modify ovl_permission() to do checks on two inodes 82/307882/1
authorVivek Goyal <vgoyal@redhat.com>
Fri, 1 Jul 2016 20:34:27 +0000 (16:34 -0400)
committerSeung-Woo Kim <sw0312.kim@samsung.com>
Thu, 14 Mar 2024 02:20:57 +0000 (11:20 +0900)
commit0dc9e711843a064686b8448e83ef091658e8776c
treee1bfd96779f13ef94e2cba83a6c3ccb6fe0f6b3d
parenta5f07e9a94a9047a199fd5a4e3c76bea80582c13
ovl: modify ovl_permission() to do checks on two inodes

commit c0ca3d70e8d3cf81e2255a217f7ca402f5ed0862 upstream.

Right now ovl_permission() calls __inode_permission(realinode), to do
permission checks on real inode and no checks are done on overlay inode.

Modify it to do checks both on overlay inode as well as underlying inode.
Checks on overlay inode will be done with the creds of calling task while
checks on underlying inode will be done with the creds of mounter.

Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
[ Srivatsa: 4.4.y backport:
  - Skipped the hunk modifying non-existent function ovl_get_acl()
  - Adjusted the error path
  - Included linux/cred.h to get prototype for revert_creds() ]
Signed-off-by: Srivatsa S. Bhat (VMware) <srivatsa@csail.mit.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[sw0312.kim: cherry-pick linux-4.4.y commit b24be4acd17a to fix smack deny issue on overlayfs]
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Change-Id: I7cdf2f9136a916c844373be56f84dfc23b8d3bcf
fs/overlayfs/inode.c