public inbox for iwd@lists.linux.dev
 help / color / mirror / Atom feed
* [PATCH 1/4] p2p: check connected peer before processing request
@ 2024-03-01 19:40 James Prestwood
  2024-03-01 19:40 ` [PATCH 2/4] eap-mschapv2: Check Password-Hash exists when loading settings James Prestwood
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: James Prestwood @ 2024-03-01 19:40 UTC (permalink / raw)
  To: iwd; +Cc: James Prestwood

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.
---
 src/p2p.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/p2p.c b/src/p2p.c
index 08fe8444..205d4fcb 100644
--- a/src/p2p.c
+++ b/src/p2p.c
@@ -2310,6 +2310,9 @@ static void p2p_device_go_negotiation_req_cb(const struct mmpdu_header *mpdu,
 	if (!peer)
 		return;
 
+	if (!dev->conn_peer)
+		return;
+
 	if (body_len < 8)
 		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,
 		6);
 
-	if (dev->is_go && dev->conn_peer) {
+	if (dev->is_go) {
 		p2p_set_group_id(dev);
 
 		dev->conn_config_delay =
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-03-12  3:12 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-01 19:40 [PATCH 1/4] p2p: check connected peer before processing request James Prestwood
2024-03-01 19:40 ` [PATCH 2/4] eap-mschapv2: Check Password-Hash exists when loading settings James Prestwood
2024-03-01 19:40 ` [PATCH 3/4] monitor: properly mask HE capabilities bitfield James Prestwood
2024-03-01 19:40 ` [PATCH 4/4] client: fix two issues caught by static analysis James Prestwood
2024-03-12  3:10 ` [PATCH 1/4] p2p: check connected peer before processing request Denis Kenzior

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox