summaryrefslogtreecommitdiff
path: root/fs/namespace.c
diff options
context:
space:
mode:
authorChristian Brauner <brauner@kernel.org>2023-03-30 10:13:16 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-04-13 18:02:50 +0300
commit65c324d3f35c05e37afec39ac80743583fdcc96c (patch)
tree0bc631c3f103654e14a1c2c15da05e2bb3600f72 /fs/namespace.c
parent1136bc37cd50d791904d80b5124752c4baad999b (diff)
downloadlinux-65c324d3f35c05e37afec39ac80743583fdcc96c.tar.xz
fs: drop peer group ids under namespace lock
commit cb2239c198ad9fbd5aced22cf93e45562da781eb upstream. When cleaning up peer group ids in the failure path we need to make sure to hold on to the namespace lock. Otherwise another thread might just turn the mount from a shared into a non-shared mount concurrently. Link: https://lore.kernel.org/lkml/00000000000088694505f8132d77@google.com Fixes: 2a1867219c7b ("fs: add mount_setattr()") Reported-by: syzbot+8ac3859139c685c4f597@syzkaller.appspotmail.com Cc: stable@vger.kernel.org # 5.12+ Message-Id: <20230330-vfs-mount_setattr-propagation-fix-v1-1-37548d91533b@kernel.org> Signed-off-by: Christian Brauner <brauner@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs/namespace.c')
-rw-r--r--fs/namespace.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/namespace.c b/fs/namespace.c
index ab467ee58341..14fa31f17d77 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -4286,9 +4286,9 @@ out:
unlock_mount_hash();
if (kattr->propagation) {
- namespace_unlock();
if (err)
cleanup_group_ids(mnt, NULL);
+ namespace_unlock();
}
return err;