be2net: Fix NULL pointer dereference in be_cmd_get_mac_from_list
Subsystems (4)
PATCH v2 1/1 be2net: Fix NULL pointer dereference in be_cmd_get_mac_from_list
From: Andrey Vatoropin <[email protected]>
When the parameter pmac_id_valid argument of be_cmd_get_mac_from_list() is set to false, the driver may request the PMAC_ID from the firmware of the network card, and this function will store that PMAC_ID at the provided address pmac_id. This is the contract of this function.
However, there is a location within the driver where both pmac_id_valid == false and pmac_id == NULL are being passed. This could result in dereferencing a NULL pointer.
To resolve this issue, it is necessary to pass the address of a stub variable to the function.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
---v1->v2: fix the problem by passing an address of a stub variable.
Link to v1: https://lore.kernel.org/netdev/[email protected]/
drivers/net/ethernet/emulex/benet/be_cmds.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/emulex/benet/be_cmds.c +2 -1
@@ -3801,6 +3801,7 @@ int be_cmd_get_perm_mac(struct be_adapter *adapter, u8 *mac) {int status;bool pmac_valid = false; +u32 pmac_id;eth_zero_addr (mac);
@@ -3813,7 +3814,7 @@ int be_cmd_get_perm_mac(struct be_adapter *adapter, u8 *mac) adapter->if_handle, 0); }else { status =be_cmd_get_mac_from_list (adapter, mac, &pmac_valid, -NULL , adapter->if_handle,0 ); + &pmac_id, adapter->if_handle,0 ); }return status;
Signature · 1 line
2.43.0
This patch was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:
Quoted 8 lines · On Tue, 20 Jan 2026 11:37:47 +0000 you wrote:
From: Andrey Vatoropin <[email protected]>
When the parameter
pmac_id_validargument ofbe_cmd_get_mac_from_list()is set to false, the driver may request thePMAC_IDfrom the firmware of the network card, and this function will store thatPMAC_IDat the provided addresspmac_id. This is the contract of this function.[...]
Here is the summary with links:
- [net,v2] be2net: Fix NULL pointer dereference in be_cmd_get_mac_from_list
https://git.kernel.org/netdev/net/c/8215794403d2
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html