netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Yang Zi <2959243019@qq.com>
Cc: "David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Paolo Abeni <pabeni@redhat.com>,
	linux-kernel@vger.kernel.org, netdev@vger.kernel.org
Subject: Re: [PATCH] niu: validate num_ports against NIU_MAX_PORTS
Date: Thu, 27 Aug 2026 12:14:14 -0700	[thread overview]
Message-ID: <20260827121414.3275d710@kernel.org> (raw)
In-Reply-To: <tencent_A16FB6B3A899F3D4CBEC0F2F5531DD502807@qq.com>

On Tue, 25 Aug 2026 17:42:42 +0800 Yang Zi wrote:
> niu_get_and_validate_port() obtains parent->num_ports from hardware
> (nr64(ESPC_NUM_PORTS_MACS) & ESPC_NUM_PORTS_MACS_VAL), an 8-bit value that
> can range from 0 to 255, with no upper-bound check.  The driver's per-port
> arrays (rxchan_per_port[], txchan_per_port[], rdc_group_cfg[]) are only
> NIU_MAX_PORTS (4) entries, so niu_divide_channels() and
> niu_divide_rdc_groups() iterate num_ports times and write out of bounds
> whenever num_ports is greater than 4.
> 
> Reject num_ports > NIU_MAX_PORTS with -EINVAL so the probe aborts before any
> of these arrays are written.
> 
> Covers fuzzing bug IDs 321, 322, 323 and 324 (same root cause).
> 
> Signed-off-by: Yang Zi <2959243019@qq.com>

this is a waste of time, please don't send any more patches to linux
networking this year

      reply	other threads:[~2026-08-27 19:14 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-25  9:42 [PATCH] niu: validate num_ports against NIU_MAX_PORTS Yang Zi
2026-08-27 19:14 ` Jakub Kicinski [this message]

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=20260827121414.3275d710@kernel.org \
    --to=kuba@kernel.org \
    --cc=2959243019@qq.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=linux-kernel@vger.kernel.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 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).