]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
ns: return EFAULT on put_user() error
authorChristian Brauner <brauner@kernel.org>
Sun, 9 Nov 2025 21:11:25 +0000 (22:11 +0100)
committerChristian Brauner <brauner@kernel.org>
Mon, 10 Nov 2025 09:20:54 +0000 (10:20 +0100)
Don't return EINVAL, return EFAULT just like we do in other system
calls.

Link: https://patch.msgid.link/20251109-namespace-6-19-fixes-v1-4-ae8a4ad5a3b3@kernel.org
Signed-off-by: Christian Brauner <brauner@kernel.org>
kernel/nstree.c

index 55b72d4f8de400cba3c023d68106cb6b6be4c007..f27f772a67622c88c5e5d91394d1cd6baaceb279 100644 (file)
@@ -584,7 +584,7 @@ static ssize_t do_listns_userns(struct klistns *kls)
 
                if (put_user(valid->ns_id, ns_ids + ret)) {
                        ns_put(prev);
-                       return -EINVAL;
+                       return -EFAULT;
                }
 
                nr_ns_ids--;
@@ -726,7 +726,7 @@ static ssize_t do_listns(struct klistns *kls)
 
                if (put_user(valid->ns_id, ns_ids + ret)) {
                        ns_put(prev);
-                       return -EINVAL;
+                       return -EFAULT;
                }
 
                nr_ns_ids--;