Skip to content

Commit 99ae3e7

Browse files
braunergregkh
authored andcommitted
mount: handle NULL values in mnt_ns_release()
[ Upstream commit 6c7ca6a02f8f9549a438a08a23c6327580ecf3d6 ] 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: Sasha Levin <[email protected]>
1 parent bf0fbf5 commit 99ae3e7

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)