From: Peter Seiderer <ps.report@gmx.net>
To: Simon Horman <horms@kernel.org>
Cc: netdev@vger.kernel.org, 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>,
Shuah Khan <shuah@kernel.org>, Nam Cao <namcao@linutronix.de>,
Thomas Gleixner <tglx@linutronix.de>,
Frederic Weisbecker <frederic@kernel.org>,
Artem Chernyshev <artem.chernyshev@red-soft.ru>
Subject: Re: [PATCH net-next v3 08/10] net: pktgen: fix access outside of user given buffer in pktgen_if_write()
Date: Wed, 5 Feb 2025 14:10:49 +0100 [thread overview]
Message-ID: <20250205141049.6f10168e@gmx.net> (raw)
In-Reply-To: <20250204105251.GO234677@kernel.org>
Hello Simon,
On Tue, 4 Feb 2025 10:52:51 +0000, Simon Horman <horms@kernel.org> wrote:
> On Mon, Feb 03, 2025 at 06:01:59PM +0100, Peter Seiderer wrote:
> > Honour the user given buffer size for the hex32_arg(), num_arg(),
> > strn_len(), get_imix_entries() and get_labels() calls (otherwise they will
> > access memory outside of the user given buffer).
> >
> > In hex32_arg(), num_arg(), strn_len() error out in case no characters are
> > available (maxlen = 0), in num_arg() additional error out in case no valid
> > character is parsed.
> >
> > In get_labels() additional enable parsing labels up to MAX_IMIX_ENTRIES
> > instead of (MAX_IMIX_ENTRIES - 1).
> >
> > Additional remove some superfluous variable initializing and align some
> > variable declarations to the most common pattern.
> >
> > Signed-off-by: Peter Seiderer <ps.report@gmx.net>
>
> ...
>
> > diff --git a/net/core/pktgen.c b/net/core/pktgen.c
>
> ...
>
> > @@ -872,7 +886,8 @@ static ssize_t get_imix_entries(const char __user *buffer,
> > if (size < 14 + 20 + 8)
> > size = 14 + 20 + 8;
> >
> > - len = num_arg(&buffer[i], max_digits, &weight);
> > + max = min(10, maxlen - i);
>
> Hi Peter,
>
> 10 is used as a magic value here. I think it would be best if
> it were a #define so it has a name. Likewise for other constants
> used as arguments to min() in this patch.
>
> ...
O.k, done in the next patch iteration...
Thanks for review!
Regards,
Peter
next prev parent reply other threads:[~2025-02-05 13:11 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-03 17:01 [PATCH net-next v3 00/10] Some pktgen fixes/improvments Peter Seiderer
2025-02-03 17:01 ` [PATCH net-next v3 01/10] net: pktgen: replace ENOTSUPP with EOPNOTSUPP Peter Seiderer
2025-02-04 14:42 ` Simon Horman
2025-02-03 17:01 ` [PATCH net-next v3 02/10] net: pktgen: enable 'param=value' parsing Peter Seiderer
2025-02-04 10:55 ` Paolo Abeni
2025-02-05 13:06 ` Peter Seiderer
2025-02-03 17:01 ` [PATCH net-next v3 03/10] net: pktgen: fix hex32_arg parsing for short reads Peter Seiderer
2025-02-04 14:43 ` Simon Horman
2025-02-03 17:01 ` [PATCH net-next v3 04/10] net: pktgen: fix 'rate 0' error handling (return -EINVAL) Peter Seiderer
2025-02-04 14:44 ` Simon Horman
2025-02-03 17:01 ` [PATCH net-next v3 05/10] net: pktgen: fix 'ratep " Peter Seiderer
2025-02-04 14:44 ` Simon Horman
2025-02-03 17:01 ` [PATCH net-next v3 06/10] net: pktgen: fix ctrl interface command parsing Peter Seiderer
2025-02-04 14:44 ` Simon Horman
2025-02-03 17:01 ` [PATCH net-next v3 07/10] net: pktgen: fix access outside of user given buffer in pktgen_thread_write() Peter Seiderer
2025-02-04 14:45 ` Simon Horman
2025-02-03 17:01 ` [PATCH net-next v3 08/10] net: pktgen: fix access outside of user given buffer in pktgen_if_write() Peter Seiderer
2025-02-04 10:40 ` Paolo Abeni
2025-02-05 13:09 ` Peter Seiderer
2025-02-04 10:52 ` Simon Horman
2025-02-05 13:10 ` Peter Seiderer [this message]
2025-02-03 17:02 ` [PATCH net-next v3 09/10] net: pktgen: fix mpls reset parsing Peter Seiderer
2025-02-04 14:45 ` Simon Horman
2025-02-03 17:02 ` [PATCH net-next v3 10/10] selftest: net: add proc_net_pktgen Peter Seiderer
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=20250205141049.6f10168e@gmx.net \
--to=ps.report@gmx.net \
--cc=artem.chernyshev@red-soft.ru \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=frederic@kernel.org \
--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=shuah@kernel.org \
--cc=tglx@linutronix.de \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).