From: Peter Seiderer <ps.report@gmx.net>
To: netdev@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org,
"David S . Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Simon Horman <horms@kernel.org>, Shuah Khan <shuah@kernel.org>,
Peter Seiderer <ps.report@gmx.net>,
Fedor Pchelkin <pchelkin@ispras.ru>,
Arnd Bergmann <arnd@arndb.de>, Nam Cao <namcao@linutronix.de>
Subject: [PATCH net-next v8 4/8] net: pktgen: fix mpls maximum labels list parsing
Date: Thu, 27 Feb 2025 14:56:00 +0100 [thread overview]
Message-ID: <20250227135604.40024-5-ps.report@gmx.net> (raw)
In-Reply-To: <20250227135604.40024-1-ps.report@gmx.net>
Fix mpls maximum labels list parsing up to MAX_MPLS_LABELS entries (instead
of up to MAX_MPLS_LABELS - 1).
Addresses the following:
$ echo "mpls 00000f00,00000f01,00000f02,00000f03,00000f04,00000f05,00000f06,00000f07,00000f08,00000f09,00000f0a,00000f0b,00000f0c,00000f0d,00000f0e,00000f0f" > /proc/net/pktgen/lo\@0
-bash: echo: write error: Argument list too long
Signed-off-by: Peter Seiderer <ps.report@gmx.net>
Reviewed-by: Simon Horman <horms@kernel.org>
---
Changes v7 -> v8
- rebased on actual net-next/main
- slightly rephrase commit message, omit '/16' (suggested by Paolo Abeni)
Changes v6 -> v7
- rebased on actual net-next/main
- no changes
Changes v5 -> v6
- adjust to dropped patch 'net: pktgen: use defines for the various
dec/hex number parsing digits lengths'
- add rev-by Simon Horman
Changes v4 -> v5
- split up patchset into part i/ii (suggested by Simon Horman)
- change patch description ('Fixes:' -> 'Addresses the following:',
suggested by Simon Horman)
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, 4 insertions(+), 2 deletions(-)
diff --git a/net/core/pktgen.c b/net/core/pktgen.c
index b678b28dedae..def35a734d9d 100644
--- a/net/core/pktgen.c
+++ b/net/core/pktgen.c
@@ -900,6 +900,10 @@ static ssize_t get_labels(const char __user *buffer, struct pktgen_dev *pkt_dev)
pkt_dev->nr_labels = 0;
do {
__u32 tmp;
+
+ if (n >= MAX_MPLS_LABELS)
+ return -E2BIG;
+
len = hex32_arg(&buffer[i], 8, &tmp);
if (len <= 0)
return len;
@@ -911,8 +915,6 @@ static ssize_t get_labels(const char __user *buffer, struct pktgen_dev *pkt_dev)
return -EFAULT;
i++;
n++;
- if (n >= MAX_MPLS_LABELS)
- return -E2BIG;
} while (c == ',');
pkt_dev->nr_labels = n;
--
2.48.1
next prev parent reply other threads:[~2025-02-27 13:56 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-27 13:55 [PATCH net-next v8 0/8] Some pktgen fixes/improvments (part II) Peter Seiderer
2025-02-27 13:55 ` [PATCH net-next v8 1/8] net: pktgen: fix mix of int/long Peter Seiderer
2025-02-27 13:55 ` [PATCH net-next v8 2/8] net: pktgen: remove extra tmp variable (re-use len instead) Peter Seiderer
2025-02-27 13:55 ` [PATCH net-next v8 3/8] net: pktgen: remove some superfluous variable initializing Peter Seiderer
2025-02-27 13:56 ` Peter Seiderer [this message]
2025-02-27 13:56 ` [PATCH net-next v8 5/8] net: pktgen: fix access outside of user given buffer in pktgen_if_write() Peter Seiderer
2025-02-27 13:56 ` [PATCH net-next v8 6/8] net: pktgen: fix mpls reset parsing Peter Seiderer
2025-02-27 13:56 ` [PATCH net-next v8 7/8] net: pktgen: remove all superfluous index assignements Peter Seiderer
2025-02-27 13:56 ` [PATCH net-next v8 8/8] selftest: net: add proc_net_pktgen Peter Seiderer
2025-03-04 10:20 ` [PATCH net-next v8 0/8] Some pktgen fixes/improvments (part II) patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250227135604.40024-5-ps.report@gmx.net \
--to=ps.report@gmx.net \
--cc=arnd@arndb.de \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=namcao@linutronix.de \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=pchelkin@ispras.ru \
--cc=shuah@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.