In nsfs_fh_to_dentry(), ns_get_unless_inactive(ns) acquires an active reference to ns before switching on ns->ns_type. Unlike the CLONE_NEWPID error path and the owning_ns permission error path, the default: branch returns ERR_PTR(-EOPNOTSUPP) without calling ns->ops->put(ns), leaking the namespace reference. Call ns->ops->put(ns) before returning ERR_PTR(-EOPNOTSUPP) in the default: branch. Assisted-by: LLM Signed-off-by: Hui Peng --- fs/nsfs.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/nsfs.c b/fs/nsfs.c index a1842e12f..e9cc09583 100644 --- a/fs/nsfs.c +++ b/fs/nsfs.c @@ -624,6 +624,7 @@ break; #endif default: + ns->ops->put(ns); return ERR_PTR(-EOPNOTSUPP); } -- 2.43.0