summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Brauner <brauner@kernel.org>2023-03-30 09:13:16 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-04-13 16:48:25 +0200
commit0af8fae81d8b7f1beddc17c5d4cfa43235134648 (patch)
tree3602dd05f921add77a8a130c9ce95f931b4689a0
parent33a503b7c33937d8bfbade7b95b55c0d8095b4bf (diff)
downloadlinux-stable-0af8fae81d8b7f1beddc17c5d4cfa43235134648.tar.gz
linux-stable-0af8fae81d8b7f1beddc17c5d4cfa43235134648.tar.bz2
linux-stable-0af8fae81d8b7f1beddc17c5d4cfa43235134648.zip
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>
-rw-r--r--fs/namespace.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/namespace.c b/fs/namespace.c
index c9b2983ae011..1a9df6afb90b 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -4121,9 +4121,9 @@ static int do_mount_setattr(struct path *path, struct mount_kattr *kattr)
unlock_mount_hash();
if (kattr->propagation) {
- namespace_unlock();
if (err)
cleanup_group_ids(mnt, NULL);
+ namespace_unlock();
}
return err;