Unverified Commit 81f16c97 authored by Qing Wang's avatar Qing Wang Committed by Christian Brauner
Browse files

statmount: Fix the null-ptr-deref in do_statmount()



If the mount is internal, it's mnt_ns will be MNT_NS_INTERNAL, which is
defined as ERR_PTR(-EINVAL). So, in the do_statmount(), need to check ns
of mount by IS_ERR() and return.

Fixes: 0e503223 ("statmount: accept fd as a parameter")
Reported-by: default avatar <syzbot+9e03a9535ea65f687a44@syzkaller.appspotmail.com>
Closes: https://lore.kernel.org/all/698e287a.a70a0220.2c38d7.009e.GAE@google.com/


Signed-off-by: default avatarQing Wang <wangqing7171@gmail.com>
Link: https://patch.msgid.link/20260213103006.2472569-1-wangqing7171@gmail.com


Reviewed-by: default avatarBhavik Sachdev <b.sachdev1904@gmail.com>
Signed-off-by: default avatarChristian Brauner <brauner@kernel.org>
parent 9eed043d
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -5678,6 +5678,8 @@ static int do_statmount(struct kstatmount *s, u64 mnt_id, u64 mnt_ns_id,

		s->mnt = mnt_file->f_path.mnt;
		ns = real_mount(s->mnt)->mnt_ns;
		if (IS_ERR(ns))
			return PTR_ERR(ns);
		if (!ns)
			/*
			 * We can't set mount point and mnt_ns_id since we don't have a