All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vadim Fedorenko <vadim.fedorenko@linux.dev>
To: Jiangshan Yi <yijiangshan@kylinos.cn>,
	skalluru@marvell.com, manishc@marvell.com, andrew+netdev@lunn.ch,
	davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
	pabeni@redhat.com
Cc: dmitry@broadcom.com, eilong@broadcom.com, ariele@broadcom.com,
	yuvalmin@broadcom.com, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, 13667453960@163.com,
	Sashiko <sashiko-bot@kernel.org>,
	stable@vger.kernel.org
Subject: Re: [PATCH v2] bnx2x: fix NULL pointer dereference in bnx2x_free_mem_bp()
Date: Mon, 17 Aug 2026 17:56:11 +0100	[thread overview]
Message-ID: <d88017c7-7089-4e85-b56e-21175310db93@linux.dev> (raw)
In-Reply-To: <20260817151326.765824-1-yijiangshan@kylinos.cn>

On 17/08/2026 16:13, Jiangshan Yi wrote:
> bnx2x_alloc_mem_bp() sets bp->fp_array_size before allocating bp->fp.
> If the fp allocation fails, the error path calls bnx2x_free_mem_bp(),
> which dereferences bp->fp in a loop bounded by the non-zero
> bp->fp_array_size, causing a NULL pointer dereference.
> 
> Move the bp->fp_array_size assignment to after bp->fp is set so that
> the loop in bnx2x_free_mem_bp() naturally becomes a no-op when bp->fp
> is NULL, since bp is zero-initialized and fp_array_size remains 0.
> 
> Fixes: c3146eb676e7c ("bnx2x: Correct memory preparation and release")
> Reported-by: Sashiko <sashiko-bot@kernel.org>
> Closes: https://sashiko.dev/#/patchset/20260815122149.951215-1-yijiangshan@kylinos.cn
> Suggested-by: Vadim Fedorenko <vadim.fedorenko@linux.dev>

No need for this tag, it's not used for code improvements

> Cc: stable@vger.kernel.org
> Signed-off-by: Jiangshan Yi <yijiangshan@kylinos.cn>

Please, review netdev contribution rules at
https://docs.kernel.org/process/maintainer-netdev.html

Especially patch formatting and 24h cool-down period

      reply	other threads:[~2026-08-17 16:56 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-17 15:13 [PATCH v2] bnx2x: fix NULL pointer dereference in bnx2x_free_mem_bp() Jiangshan Yi
2026-08-17 16:56 ` Vadim Fedorenko [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=d88017c7-7089-4e85-b56e-21175310db93@linux.dev \
    --to=vadim.fedorenko@linux.dev \
    --cc=13667453960@163.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=ariele@broadcom.com \
    --cc=davem@davemloft.net \
    --cc=dmitry@broadcom.com \
    --cc=edumazet@google.com \
    --cc=eilong@broadcom.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=manishc@marvell.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=sashiko-bot@kernel.org \
    --cc=skalluru@marvell.com \
    --cc=stable@vger.kernel.org \
    --cc=yijiangshan@kylinos.cn \
    --cc=yuvalmin@broadcom.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.