Skip to content

Commit 6c7ca6a

Browse files
braunertorvalds
authored andcommitted
mount: handle NULL values in mnt_ns_release()
When calling in listmount() mnt_ns_release() may be passed a NULL pointer. Handle that case gracefully. Signed-off-by: Christian Brauner <brauner@kernel.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent b7ce6fa commit 6c7ca6a

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

fs/namespace.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ static void mnt_ns_tree_add(struct mnt_namespace *ns)
180180
static void mnt_ns_release(struct mnt_namespace *ns)
181181
{
182182
/* keep alive for {list,stat}mount() */
183-
if (refcount_dec_and_test(&ns->passive)) {
183+
if (ns && refcount_dec_and_test(&ns->passive)) {
184184
fsnotify_mntns_delete(ns);
185185
put_user_ns(ns->user_ns);
186186
kfree(ns);

0 commit comments

Comments
 (0)