3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-11-22 14:49:24 +01:00

p2p: check connected peer before processing request

Caught by static analysis, the dev->conn_peer pointer was being
dereferenced very early on without a NULL check, but further it
was being NULL checked. If there is a possibility of it being NULL
the check should be done much earlier.
This commit is contained in:
James Prestwood 2024-03-01 11:40:53 -08:00 committed by Denis Kenzior
parent 71a7190ed2
commit 795f57e816

View File

@ -2310,6 +2310,9 @@ static void p2p_device_go_negotiation_req_cb(const struct mmpdu_header *mpdu,
if (!peer) if (!peer)
return; return;
if (!dev->conn_peer)
return;
if (body_len < 8) if (body_len < 8)
return; return;
@ -2438,7 +2441,7 @@ static void p2p_device_go_negotiation_req_cb(const struct mmpdu_header *mpdu,
memcpy(dev->conn_peer_interface_addr, req_info.intended_interface_addr, memcpy(dev->conn_peer_interface_addr, req_info.intended_interface_addr,
6); 6);
if (dev->is_go && dev->conn_peer) { if (dev->is_go) {
p2p_set_group_id(dev); p2p_set_group_id(dev);
dev->conn_config_delay = dev->conn_config_delay =