diff options
| author | Haoxiang Li <lihaoxiang@isrc.iscas.ac.cn> | 2026-06-09 15:46:10 +0800 |
|---|---|---|
| committer | Jakub Kicinski <kuba@kernel.org> | 2026-06-11 15:09:16 -0700 |
| commit | 034b95cf69e0b1d5490a00b0305426762938a035 (patch) | |
| tree | 022eace4c30537a17ace40c42ab586f0db92d541 /include/linux | |
| parent | dad4d4b92a9b9f0edb8c66deda049da1b62f6089 (diff) | |
bnx2x: fix resource leaks in bnx2x_init_one() error paths
bnx2x_init_one() falls through to the common memory cleanup path for
several failures after probe has already acquired additional resources.
If register_netdev() fails after bnx2x_set_int_mode(), MSI/MSI-X remains
enabled. If later failures happen after bnx2x_iov_init_one(), PF SR-IOV
state can be left allocated. Also, failures after bnx2x_vfpf_acquire()
must release the PF resources before freeing the VF-PF mailbox allocated
by bnx2x_vf_pci_alloc().
Add error labels matching the resource acquisition order so probe failure
disables MSI/MSI-X, removes SR-IOV state, releases VF-PF resources,
deallocates VF PCI resources, and then frees the common driver memory.
Also clear PCI drvdata before freeing the netdev on probe failure.
Cc: stable+noautosel@kernel.org # untested fix to unlikely error path
Signed-off-by: Haoxiang Li <lihaoxiang@isrc.iscas.ac.cn>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20260609074610.1968721-1-lihaoxiang@isrc.iscas.ac.cn
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'include/linux')
0 files changed, 0 insertions, 0 deletions
