summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrey Vatoropin <a.vatoropin@crpt.ru>2026-01-20 14:37:47 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2026-01-30 12:27:37 +0300
commite206fb415db36bad52bb90c08d46ce71ffbe8a80 (patch)
treeb51b5a7b6230422a9fe21b428e4901c0cc4ee436
parentbaafbbc23d42179fe9d271239be65f82c70627db (diff)
downloadlinux-e206fb415db36bad52bb90c08d46ce71ffbe8a80.tar.xz
be2net: Fix NULL pointer dereference in be_cmd_get_mac_from_list
[ Upstream commit 8215794403d264739cc676668087512950b2ff31 ] 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. Fixes: 95046b927a54 ("be2net: refactor MAC-addr setup code") Signed-off-by: Andrey Vatoropin <a.vatoropin@crpt.ru> Link: https://patch.msgid.link/20260120113734.20193-1-a.vatoropin@crpt.ru Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r--drivers/net/ethernet/emulex/benet/be_cmds.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/net/ethernet/emulex/benet/be_cmds.c b/drivers/net/ethernet/emulex/benet/be_cmds.c
index 779f1324bb5f..0cda78b78fb8 100644
--- a/drivers/net/ethernet/emulex/benet/be_cmds.c
+++ b/drivers/net/ethernet/emulex/benet/be_cmds.c
@@ -3797,6 +3797,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);
@@ -3809,7 +3810,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;