Commit 9ab6a99
bnxt_en: Fix memory corruption when FW resources change during ifdown
[ Upstream commit 2747328 ]
bnxt_set_dflt_rings() assumes that it is always called before any TC has
been created. So it doesn't take bp->num_tc into account and assumes
that it is always 0 or 1.
In the FW resource or capability change scenario, the FW will return
flags in bnxt_hwrm_if_change() that will cause the driver to
reinitialize and call bnxt_cancel_reservations(). This will lead to
bnxt_init_dflt_ring_mode() calling bnxt_set_dflt_rings() and bp->num_tc
may be greater than 1. This will cause bp->tx_ring[] to be sized too
small and cause memory corruption in bnxt_alloc_cp_rings().
Fix it by properly scaling the TX rings by bp->num_tc in the code
paths mentioned above. Add 2 helper functions to determine
bp->tx_nr_rings and bp->tx_nr_rings_per_tc.
Fixes: ec5d31e ("bnxt_en: Handle firmware reset status during IF_UP.")
Reviewed-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Andy Gospodarek <andrew.gospodarek@broadcom.com>
Signed-off-by: Sreekanth Reddy <sreekanth.reddy@broadcom.com>
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Link: https://patch.msgid.link/20250825175927.459987-2-michael.chan@broadcom.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>1 parent 1228285 commit 9ab6a99
1 file changed
Lines changed: 16 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12844 | 12844 | | |
12845 | 12845 | | |
12846 | 12846 | | |
| 12847 | + | |
| 12848 | + | |
| 12849 | + | |
| 12850 | + | |
| 12851 | + | |
| 12852 | + | |
| 12853 | + | |
| 12854 | + | |
| 12855 | + | |
| 12856 | + | |
| 12857 | + | |
12847 | 12858 | | |
12848 | 12859 | | |
12849 | 12860 | | |
| |||
16338 | 16349 | | |
16339 | 16350 | | |
16340 | 16351 | | |
16341 | | - | |
| 16352 | + | |
16342 | 16353 | | |
16343 | 16354 | | |
16344 | 16355 | | |
| |||
16370 | 16381 | | |
16371 | 16382 | | |
16372 | 16383 | | |
16373 | | - | |
| 16384 | + | |
16374 | 16385 | | |
16375 | 16386 | | |
16376 | 16387 | | |
| |||
16383 | 16394 | | |
16384 | 16395 | | |
16385 | 16396 | | |
16386 | | - | |
| 16397 | + | |
16387 | 16398 | | |
16388 | 16399 | | |
16389 | 16400 | | |
| |||
16392 | 16403 | | |
16393 | 16404 | | |
16394 | 16405 | | |
16395 | | - | |
| 16406 | + | |
16396 | 16407 | | |
16397 | 16408 | | |
16398 | 16409 | | |
| |||
16426 | 16437 | | |
16427 | 16438 | | |
16428 | 16439 | | |
16429 | | - | |
| 16440 | + | |
16430 | 16441 | | |
16431 | 16442 | | |
16432 | 16443 | | |
| |||
0 commit comments