ovl: fix permission checking for setattr
authorMiklos Szeredi <miklos@szeredi.hu>
Fri, 4 Dec 2015 18:18:48 +0000 (19:18 +0100)
committerSasha Levin <sasha.levin@oracle.com>
Wed, 13 Apr 2016 21:14:29 +0000 (17:14 -0400)
commit2cadb57dff500076a87b934cac64bb5a2293b644
tree80c1f7fccfb9d746124a842065fc358baff0e3d0
parent50d93d381508139a35a0f91a364fbdc1a38885d4
ovl: fix permission checking for setattr

[ Upstream commit acff81ec2c79492b180fade3c2894425cd35a545 ]

[Al Viro] The bug is in being too enthusiastic about optimizing ->setattr()
away - instead of "copy verbatim with metadata" + "chmod/chown/utimes"
(with the former being always safe and the latter failing in case of
insufficient permissions) it tries to combine these two.  Note that copyup
itself will have to do ->setattr() anyway; _that_ is where the elevated
capabilities are right.  Having these two ->setattr() (one to set verbatim
copy of metadata, another to do what overlayfs ->setattr() had been asked
to do in the first place) combined is where it breaks.

Signed-off-by: Miklos Szeredi <miklos@szeredi.hu>
Cc: <stable@vger.kernel.org>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
fs/overlayfs/inode.c