]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
ovl: handle ATTR_KILL*
authorMiklos Szeredi <mszeredi@redhat.com>
Mon, 4 Jul 2016 14:49:48 +0000 (16:49 +0200)
committerSasha Levin <alexander.levin@verizon.com>
Mon, 8 Aug 2016 01:44:50 +0000 (21:44 -0400)
commitd4e1ac55843e799890318798794d7e6b48a68d4c
treea6327728a903514f14f1b4ff3bcced135482e34c
parent69fb704cac4d3eb59b407f8cc8fa366c44e71318
ovl: handle ATTR_KILL*

[ Upstream commit b99c2d913810e56682a538c9f2394d76fca808f8 ]

Before 4bacc9c9234c ("overlayfs: Make f_path...") file->f_path pointed to
the underlying file, hence suid/sgid removal on write worked fine.

After that patch file->f_path pointed to the overlay file, and the file
mode bits weren't copied to overlay_inode->i_mode.  So the suid/sgid
removal simply stopped working.

The fix is to copy the mode bits, but then ovl_setattr() needs to clear
ATTR_MODE to avoid the BUG() in notify_change().  So do this first, then in
the next patch copy the mode.

Reported-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Fixes: 4bacc9c9234c ("overlayfs: Make f_path always point to the overlay and f_inode to the underlay")
Cc: <stable@vger.kernel.org>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
fs/overlayfs/inode.c