[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250205131153.476278-15-ps.report@gmx.net>
Date: Wed, 5 Feb 2025 14:11:50 +0100
From: Peter Seiderer <ps.report@....net>
To: netdev@...r.kernel.org
Cc: linux-kernel@...r.kernel.org,
linux-kselftest@...r.kernel.org,
"David S . Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>,
Simon Horman <horms@...nel.org>,
Shuah Khan <shuah@...nel.org>,
Peter Seiderer <ps.report@....net>
Subject: [PATCH net-next v4 14/17] net: pktgen: hex32_arg/num_arg error out in case no characters are available
In hex32_arg() and num_arg() error out in case no characters are available
(maxlen = 0).
Signed-off-by: Peter Seiderer <ps.report@....net>
---
Changes v3 -> v4
- new patch (factored out of patch 'net: pktgen: fix access outside of user
given buffer in pktgen_if_write()')
---
net/core/pktgen.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/net/core/pktgen.c b/net/core/pktgen.c
index 3c42ecf17ba2..cb3b732fd0a3 100644
--- a/net/core/pktgen.c
+++ b/net/core/pktgen.c
@@ -761,6 +761,9 @@ static int hex32_arg(const char __user *user_buffer, unsigned long maxlen,
int i = 0;
*num = 0;
+ if (!maxlen)
+ return -EINVAL;
+
for (; i < maxlen; i++) {
int value;
char c;
@@ -808,6 +811,9 @@ static long num_arg(const char __user *user_buffer, unsigned long maxlen,
int i;
*num = 0;
+ if (!maxlen)
+ return -EINVAL;
+
for (i = 0; i < maxlen; i++) {
char c;
if (get_user(c, &user_buffer[i]))
--
2.48.1
Powered by blists - more mailing lists