Skip to content

Commit 076db72

Browse files
Andrey VatoropinUlrich Hecht
authored andcommitted
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: 95046b9 ("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> Signed-off-by: Ulrich Hecht <uli@kernel.org>
1 parent 1afe4a2 commit 076db72

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

drivers/net/ethernet/emulex/benet/be_cmds.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3800,6 +3800,7 @@ int be_cmd_get_perm_mac(struct be_adapter *adapter, u8 *mac)
38003800
{
38013801
int status;
38023802
bool pmac_valid = false;
3803+
u32 pmac_id;
38033804

38043805
eth_zero_addr(mac);
38053806

@@ -3812,7 +3813,7 @@ int be_cmd_get_perm_mac(struct be_adapter *adapter, u8 *mac)
38123813
adapter->if_handle, 0);
38133814
} else {
38143815
status = be_cmd_get_mac_from_list(adapter, mac, &pmac_valid,
3815-
NULL, adapter->if_handle, 0);
3816+
&pmac_id, adapter->if_handle, 0);
38163817
}
38173818

38183819
return status;

0 commit comments

Comments
 (0)