From: Christian Brauner Date: Thu, 30 Mar 2023 07:13:16 +0000 (+0200) Subject: fs: drop peer group ids under namespace lock X-Git-Tag: v6.1.37~2332 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ddca03d97daa7b07b60c52e3d3060762732c6666;p=platform%2Fkernel%2Flinux-starfive.git 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 Signed-off-by: Greg Kroah-Hartman --- diff --git a/fs/namespace.c b/fs/namespace.c index df137ba..e04a9e9 100644 --- a/fs/namespace.c +++ b/fs/namespace.c @@ -4180,9 +4180,9 @@ out: unlock_mount_hash(); if (kattr->propagation) { - namespace_unlock(); if (err) cleanup_group_ids(mnt, NULL); + namespace_unlock(); } return err;