mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH net] cxgb4: clear the sge maps and bitmaps freed on adap_init0()  failure
@ 2026-11-04 10:33 Thomas Fourier
  2026-11-04 10:39 ` netdev-bot+sinfo
  0 siblings, 1 reply; 2+ messages in thread
From: Thomas Fourier @ 2026-11-04 10:33 UTC (permalink / raw)
  Cc: Thomas Fourier, Potnuri Bharat Teja, Andrew Lunn,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Hariprasad Shenai, open list:CXGB4 ETHERNET DRIVER (CXGB4),
	open list

The bye: label of adap_init0() frees sge.egr_map, sge.ingr_map,
sge.starving_fl, sge.txq_maperr and sge.blocked_fl but leaves the
pointers set. If the call of adapt_init0() from eeh_reset_done() fails,
then a subsequent call to remove_one() may call free_some_resources(), and
free the resource again.

Clear the pointers after freeing them.

This bug is theoretical and was found statically.

Signed-off-by: Thomas Fourier <fourier.thomas@gmail.com>
Fixes: 4b8e27a86d20 ("cxgb4: Allocate dynamic mem. for egress and ingress queue maps")
---
 drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
index d449cca00608..9176653c7d70 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
@@ -5402,11 +5402,16 @@ static int adap_init0(struct adapter *adap, int vpd_skip)
 bye:
 	adap_free_hma_mem(adap);
 	kfree(adap->sge.egr_map);
+	adap->sge.egr_map = NULL;
 	kfree(adap->sge.ingr_map);
+	adap->sge.ingr_map = NULL;
 	bitmap_free(adap->sge.starving_fl);
+	adap->sge.starving_fl = NULL;
 	bitmap_free(adap->sge.txq_maperr);
+	adap->sge.txq_maperr = NULL;
 #ifdef CONFIG_DEBUG_FS
 	bitmap_free(adap->sge.blocked_fl);
+	adap->sge.blocked_fl = NULL;
 #endif
 	if (ret != -ETIMEDOUT && ret != -EIO)
 		t4_fw_bye(adap, adap->mbox);
-- 
2.53.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH net] cxgb4: clear the sge maps and bitmaps freed on adap_init0() failure
  2026-11-04 10:33 [PATCH net] cxgb4: clear the sge maps and bitmaps freed on adap_init0() failure Thomas Fourier
@ 2026-11-04 10:39 ` netdev-bot+sinfo
  0 siblings, 0 replies; 2+ messages in thread
From: netdev-bot+sinfo @ 2026-11-04 10:39 UTC (permalink / raw)
  To: Thomas Fourier
  Cc: Potnuri Bharat Teja, Andrew Lunn, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Hariprasad Shenai, netdev,
	linux-kernel

Hi!

This is an automated message. This series looks like a fix, but its
commit messages seem to be missing some information:

 - What hardware the change was tested on. For driver fixes please
   mention the device (and if relevant firmware version) used for
   testing, or say that the change was not tested on real hardware.

Please do not repost the series just to address the above. Instead,
reply to this email with the missing information, so that reviewers
can take it into account. If the series needs another revision for
other reasons, please include the information in the commit messages
then.

The evaluation is done by an LLM so it may be wrong, if you think
that is the case please reply and explain.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-04 10:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-04 10:33 [PATCH net] cxgb4: clear the sge maps and bitmaps freed on adap_init0() failure Thomas Fourier
2026-11-04 10:39 ` netdev-bot+sinfo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®