From 2f2eaf7b6f7fcdae72031da50567e7ae81cb0264 Mon Sep 17 00:00:00 2001 From: Peter Mitsis Date: Tue, 13 May 2025 11:06:15 -0700 Subject: [PATCH] arch: xtensa: Update arch_user_string_nlen() When calling device_get_binding(NULL) from userspace, this eventually funnels down to a call to arch_user_string_nlen() where it tried to verify that the kernel has access to this address (0x0). But since this originates from userspace, we really want to know if this is accessible from userspace, so using arch_buffer_validate() instead of xtensa_mem_kernel_has_access() is preferable. Signed-off-by: Peter Mitsis --- arch/xtensa/core/syscall_helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/xtensa/core/syscall_helper.c b/arch/xtensa/core/syscall_helper.c index a4a44eba6e2..40c936f4fc7 100644 --- a/arch/xtensa/core/syscall_helper.c +++ b/arch/xtensa/core/syscall_helper.c @@ -115,7 +115,7 @@ size_t arch_user_string_nlen(const char *s, size_t maxsize, int *err_arg) * For MPU systems, this would simply results in access errors * and the exception handler will terminate the thread. */ - if (!xtensa_mem_kernel_has_access(s, maxsize, 0)) { + if (arch_buffer_validate(s, maxsize, 0)) { /* * API says we need to set err_arg to -1 if there are * any errors.