From: Uday Shankar <ushankar@purestorage.com>
To: Paolo Abeni <pabeni@redhat.com>
Cc: Breno Leitao <leitao@debian.org>,
"David S . Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Simon Horman <horms@kernel.org>,
netdev@vger.kernel.org
Subject: Re: [PATCH] netconsole: allow selection of egress interface via MAC address
Date: Thu, 12 Dec 2024 14:59:54 -0700 [thread overview]
Message-ID: <Z1tc2j88lNv19gzq@dev-ushankar.dev.purestorage.com> (raw)
In-Reply-To: <b7bfd346-71d2-481f-bb9f-e3bc1d6d53f0@redhat.com>
On Thu, Dec 12, 2024 at 01:34:12PM +0100, Paolo Abeni wrote:
> On 12/11/24 03:18, Uday Shankar wrote:
> > +static ssize_t local_mac_store(struct config_item *item, const char *buf,
> > + size_t count)
> > +{
> > + struct netconsole_target *nt = to_target(item);
> > + u8 local_mac[ETH_ALEN];
> > + ssize_t ret = -EINVAL;
> > +
> > + mutex_lock(&dynamic_netconsole_mutex);
> > + if (nt->enabled) {
> > + pr_err("target (%s) is enabled, disable to update parameters\n",
> > + config_item_name(&nt->group.cg_item));
> > + goto out_unlock;
> > + }
> > +
> > + if (!mac_pton(buf, local_mac))
> > + goto out_unlock;
> > + if (buf[3 * ETH_ALEN - 1] && buf[3 * ETH_ALEN - 1] != '\n')
> > + goto out_unlock;
>
> I think you should instead check 'count >= 3 * ETH_ALEN', and do such
> check before calling 'mac_pton'.
Is that needed? mac_pton has an internal check based on strnlen, which
is guaranteed to succeed because the kernfs layer will NUL-terminate buf
for us.
next prev parent reply other threads:[~2024-12-12 21:59 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-11 2:18 [PATCH] netconsole: allow selection of egress interface via MAC address Uday Shankar
2024-12-12 10:11 ` Simon Horman
2024-12-12 22:31 ` Uday Shankar
2024-12-13 10:34 ` Simon Horman
2024-12-12 12:34 ` Paolo Abeni
2024-12-12 21:59 ` Uday Shankar [this message]
2025-01-03 11:41 ` Breno Leitao
2025-01-08 15:02 ` Uday Shankar
2025-01-09 15:43 ` Breno Leitao
2025-02-03 13:12 ` Breno Leitao
2025-02-03 20:29 ` Uday Shankar
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=Z1tc2j88lNv19gzq@dev-ushankar.dev.purestorage.com \
--to=ushankar@purestorage.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=leitao@debian.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
/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.