* [bug report] listmount: don't call path_put() under namespace semaphore
@ 2025-09-25 12:57 Dan Carpenter
2025-09-29 9:33 ` Christian Brauner
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2025-09-25 12:57 UTC (permalink / raw)
To: Christian Brauner; +Cc: linux-fsdevel
Hello Christian Brauner,
Commit 59bfb6681680 ("listmount: don't call path_put() under
namespace semaphore") from Sep 19, 2025 (linux-next), leads to the
following Smatch static checker warning:
fs/namespace.c:5939 __do_sys_listmount()
warn: pointer dereferenced without being set 'kls.ns'
fs/namespace.c
5903 static void __free_klistmount_free(const struct klistmount *kls)
5904 {
5905 path_put(&kls->root);
5906 kvfree(kls->kmnt_ids);
5907 mnt_ns_release(kls->ns);
5908 }
[ snip ]
5936 SYSCALL_DEFINE4(listmount, const struct mnt_id_req __user *, req,
5937 u64 __user *, mnt_ids, size_t, nr_mnt_ids, unsigned int, flags)
5938 {
--> 5939 struct klistmount kls __free(klistmount_free) = {};
5940 const size_t maxcount = 1000000;
5941 struct mnt_id_req kreq;
5942 ssize_t ret;
5943
5944 if (flags & ~LISTMOUNT_REVERSE)
5945 return -EINVAL;
The __free_klistmount_free() function will dereference kls->ns when it
calls mnt_ns_release() but it's NULL on this path.
5946
5947 /*
5948 * If the mount namespace really has more than 1 million mounts the
5949 * caller must iterate over the mount namespace (and reconsider their
regards,
dan carpenter
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [bug report] listmount: don't call path_put() under namespace semaphore
2025-09-25 12:57 [bug report] listmount: don't call path_put() under namespace semaphore Dan Carpenter
@ 2025-09-29 9:33 ` Christian Brauner
0 siblings, 0 replies; 2+ messages in thread
From: Christian Brauner @ 2025-09-29 9:33 UTC (permalink / raw)
To: Dan Carpenter; +Cc: linux-fsdevel
On Thu, Sep 25, 2025 at 03:57:43PM +0300, Dan Carpenter wrote:
> Hello Christian Brauner,
>
> Commit 59bfb6681680 ("listmount: don't call path_put() under
> namespace semaphore") from Sep 19, 2025 (linux-next), leads to the
> following Smatch static checker warning:
Thank you, I will handle this.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-09-29 9:33 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-25 12:57 [bug report] listmount: don't call path_put() under namespace semaphore Dan Carpenter
2025-09-29 9:33 ` Christian Brauner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).