Skip to content

Commit 2d68f8a

Browse files
braunergregkh
authored andcommitted
mount: handle NULL values in mnt_ns_release()
commit 6c7ca6a upstream. When calling in listmount() mnt_ns_release() may be passed a NULL pointer. Handle that case gracefully. Signed-off-by: Christian Brauner <[email protected]> Signed-off-by: Linus Torvalds <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent e051ab6 commit 2d68f8a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fs/namespace.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ static void mnt_ns_release(struct mnt_namespace *ns)
153153
lockdep_assert_not_held(&mnt_ns_tree_lock);
154154

155155
/* keep alive for {list,stat}mount() */
156-
if (refcount_dec_and_test(&ns->passive)) {
156+
if (ns && refcount_dec_and_test(&ns->passive)) {
157157
put_user_ns(ns->user_ns);
158158
kfree(ns);
159159
}

0 commit comments

Comments
 (0)