Skip to content

Commit 8215794

Browse files
Andrey Vatoropinkuba-moo
authored andcommitted
be2net: Fix NULL pointer dereference in be_cmd_get_mac_from_list
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>
1 parent 2030c43 commit 8215794

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
@@ -3801,6 +3801,7 @@ int be_cmd_get_perm_mac(struct be_adapter *adapter, u8 *mac)
38013801
{
38023802
int status;
38033803
bool pmac_valid = false;
3804+
u32 pmac_id;
38043805

38053806
eth_zero_addr(mac);
38063807

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

38193820
return status;

0 commit comments

Comments
 (0)