Commit 2747328
bnxt_en: Fix memory corruption when FW resources change during ifdown
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 <[email protected]>
Reviewed-by: Andy Gospodarek <[email protected]>
Signed-off-by: Sreekanth Reddy <[email protected]>
Signed-off-by: Michael Chan <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Jakub Kicinski <[email protected]>1 parent d9b0ca1 commit 2747328
1 file changed
+16
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12851 | 12851 | | |
12852 | 12852 | | |
12853 | 12853 | | |
| 12854 | + | |
| 12855 | + | |
| 12856 | + | |
| 12857 | + | |
| 12858 | + | |
| 12859 | + | |
| 12860 | + | |
| 12861 | + | |
| 12862 | + | |
| 12863 | + | |
| 12864 | + | |
12854 | 12865 | | |
12855 | 12866 | | |
12856 | 12867 | | |
| |||
16325 | 16336 | | |
16326 | 16337 | | |
16327 | 16338 | | |
16328 | | - | |
| 16339 | + | |
16329 | 16340 | | |
16330 | 16341 | | |
16331 | 16342 | | |
| |||
16357 | 16368 | | |
16358 | 16369 | | |
16359 | 16370 | | |
16360 | | - | |
| 16371 | + | |
16361 | 16372 | | |
16362 | 16373 | | |
16363 | 16374 | | |
| |||
16370 | 16381 | | |
16371 | 16382 | | |
16372 | 16383 | | |
16373 | | - | |
| 16384 | + | |
16374 | 16385 | | |
16375 | 16386 | | |
16376 | 16387 | | |
| |||
16379 | 16390 | | |
16380 | 16391 | | |
16381 | 16392 | | |
16382 | | - | |
| 16393 | + | |
16383 | 16394 | | |
16384 | 16395 | | |
16385 | 16396 | | |
| |||
16413 | 16424 | | |
16414 | 16425 | | |
16415 | 16426 | | |
16416 | | - | |
| 16427 | + | |
16417 | 16428 | | |
16418 | 16429 | | |
16419 | 16430 | | |
| |||
0 commit comments