Re: [PATCH RFC v3 03/10] openat2: explicitly return -E2BIG for (usize > PAGE_SIZE)

From
Greg KH <gregkh@linuxfoundation.org>
Date
2024-10-10 06:24:34
Also in
linux-arch, linux-fsdevel, linux-kselftest, lkml, stable
Reply to
Aleksa Sarai, 2024-10-09
On Thu, Oct 10, 2024 at 07:40:36AM +1100, Aleksa Sarai wrote:
quoted hunk ↗ jump to hunk
While we do currently return -EFAULT in this case, it seems prudent to
follow the behaviour of other syscalls like clone3. It seems quite
unlikely that anyone depends on this error code being EFAULT, but we can
always revert this if it turns out to be an issue.

Cc: <redacted> # v5.6+
Fixes: fddb5d430ad9 ("open: introduce openat2(2) syscall")
Signed-off-by: Aleksa Sarai <redacted>
---
 fs/open.c | 2 ++
 1 file changed, 2 insertions(+)
diff --git a/fs/open.c b/fs/open.c
index 22adbef7ecc2..30bfcddd505d 100644
--- a/fs/open.c
+++ b/fs/open.c
@@ -1458,6 +1458,8 @@ SYSCALL_DEFINE4(openat2, int, dfd, const char __user *, filename,
 
 	if (unlikely(usize < OPEN_HOW_SIZE_VER0))
 		return -EINVAL;
+	if (unlikely(usize > PAGE_SIZE))
+		return -E2BIG;
 
 	err = copy_struct_from_user(&tmp, sizeof(tmp), how, usize);
 	if (err)
-- 
2.46.1
Why isn't this just sent as a normal fix to be included now and not
burried in a RFC series?

thanks,

greg k-h
Thread (15 messages) 15 messages, 3 authors, last reply 2024-10-21
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help