[PATCH 4/8] ns: return EFAULT on put_user() error
From: Christian Brauner
Date: Sun Nov 09 2025 - 16:16:06 EST
Don't return EINVAL, return EFAULT just like we do in other system
calls.
Signed-off-by: Christian Brauner <brauner@xxxxxxxxxx>
---
kernel/nstree.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/kernel/nstree.c b/kernel/nstree.c
index 55b72d4f8de4..f27f772a6762 100644
--- a/kernel/nstree.c
+++ b/kernel/nstree.c
@@ -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--;
--
2.47.3