Commit d00e989
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 3d6a89f commit d00e989
1 file changed
Lines changed: 16 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12241 | 12241 | | |
12242 | 12242 | | |
12243 | 12243 | | |
| 12244 | + | |
| 12245 | + | |
| 12246 | + | |
| 12247 | + | |
| 12248 | + | |
| 12249 | + | |
| 12250 | + | |
| 12251 | + | |
| 12252 | + | |
| 12253 | + | |
| 12254 | + | |
12244 | 12255 | | |
12245 | 12256 | | |
12246 | 12257 | | |
| |||
15676 | 15687 | | |
15677 | 15688 | | |
15678 | 15689 | | |
15679 | | - | |
| 15690 | + | |
15680 | 15691 | | |
15681 | 15692 | | |
15682 | 15693 | | |
| |||
15708 | 15719 | | |
15709 | 15720 | | |
15710 | 15721 | | |
15711 | | - | |
| 15722 | + | |
15712 | 15723 | | |
15713 | 15724 | | |
15714 | 15725 | | |
| |||
15721 | 15732 | | |
15722 | 15733 | | |
15723 | 15734 | | |
15724 | | - | |
| 15735 | + | |
15725 | 15736 | | |
15726 | 15737 | | |
15727 | 15738 | | |
| |||
15730 | 15741 | | |
15731 | 15742 | | |
15732 | 15743 | | |
15733 | | - | |
| 15744 | + | |
15734 | 15745 | | |
15735 | 15746 | | |
15736 | 15747 | | |
| |||
15764 | 15775 | | |
15765 | 15776 | | |
15766 | 15777 | | |
15767 | | - | |
| 15778 | + | |
15768 | 15779 | | |
15769 | 15780 | | |
15770 | 15781 | | |
| |||
0 commit comments