[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20231102191914.52957-2-pstanner@redhat.com>
Date: Thu, 2 Nov 2023 20:19:15 +0100
From: Philipp Stanner <pstanner@...hat.com>
To: "David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>,
Stanislav Fomichev <sdf@...gle.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Benjamin Tissoires <benjamin.tissoires@...hat.com>,
Al Viro <viro@...iv.linux.org.uk>
Cc: linux-ppp@...r.kernel.org, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org,
Philipp Stanner <pstanner@...hat.com>,
Dave Airlie <airlied@...hat.com>
Subject: [PATCH] drivers/net/ppp: copy userspace array safely
In ppp_generic.c memdup_user() is utilized to copy a userspace array.
This is done without an overflow check.
Use the new wrapper memdup_array_user() to copy the array more safely.
Suggested-by: Dave Airlie <airlied@...hat.com>
Signed-off-by: Philipp Stanner <pstanner@...hat.com>
---
drivers/net/ppp/ppp_generic.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ppp/ppp_generic.c b/drivers/net/ppp/ppp_generic.c
index a9beacd552cf..0193af2d31c9 100644
--- a/drivers/net/ppp/ppp_generic.c
+++ b/drivers/net/ppp/ppp_generic.c
@@ -570,8 +570,8 @@ static struct bpf_prog *get_filter(struct sock_fprog *uprog)
/* uprog->len is unsigned short, so no overflow here */
fprog.len = uprog->len;
- fprog.filter = memdup_user(uprog->filter,
- uprog->len * sizeof(struct sock_filter));
+ fprog.filter = memdup_array_user(uprog->filter,
+ uprog->len, sizeof(struct sock_filter));
if (IS_ERR(fprog.filter))
return ERR_CAST(fprog.filter);
--
2.41.0
Powered by blists - more mailing lists