[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20231107122745.3761613-9-sashal@kernel.org>
Date: Tue, 7 Nov 2023 07:26:48 -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, nick.alcock@...cle.com, ddiss@...e.de,
code@...dh.me
Subject: [PATCH AUTOSEL 6.1 09/25] 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 28ed71d277bd7..442bb92212f2a 100644
--- a/kernel/watch_queue.c
+++ b/kernel/watch_queue.c
@@ -332,7 +332,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