[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20231107121837.3759358-16-sashal@kernel.org>
Date: Tue, 7 Nov 2023 07:16:18 -0500
From: Sasha Levin <sashal@...nel.org>
To: linux-kernel@...r.kernel.org, stable@...r.kernel.org
Cc: Philipp Stanner <pstanner@...hat.com>,
David Airlie <airlied@...hat.com>,
Kees Cook <keescook@...omium.org>,
Zack Rusin <zackr@...are.com>, Sasha Levin <sashal@...nel.org>,
brauner@...nel.org, dhowells@...hat.com, code@...dh.me,
ddiss@...e.de, nick.alcock@...cle.com
Subject: [PATCH AUTOSEL 6.6 16/40] kernel: watch_queue: copy user-array safely
From: Philipp Stanner <pstanner@...hat.com>
[ Upstream commit ca0776571d3163bd03b3e8c9e3da936abfaecbf6 ]
Currently, there is no overflow-check with memdup_user().
Use the new function memdup_array_user() instead of memdup_user() for
duplicating the user-space array safely.
Suggested-by: David Airlie <airlied@...hat.com>
Signed-off-by: Philipp Stanner <pstanner@...hat.com>
Reviewed-by: Kees Cook <keescook@...omium.org>
Reviewed-by: Zack Rusin <zackr@...are.com>
Signed-off-by: Dave Airlie <airlied@...hat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230920123612.16914-5-pstanner@redhat.com
Signed-off-by: Sasha Levin <sashal@...nel.org>
---
kernel/watch_queue.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/watch_queue.c b/kernel/watch_queue.c
index d0b6b390ee423..778b4056700ff 100644
--- a/kernel/watch_queue.c
+++ b/kernel/watch_queue.c
@@ -331,7 +331,7 @@ long watch_queue_set_filter(struct pipe_inode_info *pipe,
filter.__reserved != 0)
return -EINVAL;
- tf = memdup_user(_filter->filters, filter.nr_filters * sizeof(*tf));
+ tf = memdup_array_user(_filter->filters, filter.nr_filters, sizeof(*tf));
if (IS_ERR(tf))
return PTR_ERR(tf);
--
2.42.0
Powered by blists - more mailing lists