[PATCH] P2P: Race condition in GO-NEG process if both peers enter =

Neeraj Garg neerajkg at broadcom.com
Mon May 21 02:23:46 EDT 2012


p2p_connect at the same time
 Signed-off-by: Neeraj Garg <neerajkg at broadcom.com>

---
 src/p2p/p2p.c        |    4 +++-
 src/p2p/p2p_go_neg.c |    1 +
 2 files changed, 4 insertions(+), 1 deletions(-)
 mode change 100644 =3D> 100755 src/p2p/p2p.c
 mode change 100644 =3D> 100755 src/p2p/p2p_go_neg.c

diff --git a/src/p2p/p2p.c b/src/p2p/p2p.c
old mode 100644
new mode 100755
index deccfc0..37a33dd
--- a/src/p2p/p2p.c
+++ b/src/p2p/p2p.c
@@ -2704,12 +2704,14 @@ static void p2p_go_neg_req_cb(struct p2p_data *p2p,=
 int success)
 	}
=20
 	if (success) {
-		dev->go_neg_req_sent++;
 		if (dev->flags & P2P_DEV_USER_REJECTED) {
 			p2p_set_state(p2p, P2P_IDLE);
 			return;
 		}
 	}
+	else {
+		dev->go_neg_req_sent--;
+	}
=20
 	if (!success &&
 	    (dev->info.dev_capab & P2P_DEV_CAPAB_CLIENT_DISCOVERABILITY) &&
diff --git a/src/p2p/p2p_go_neg.c b/src/p2p/p2p_go_neg.c
old mode 100644
new mode 100755
index 2bf48b3..727d445
--- a/src/p2p/p2p_go_neg.c
+++ b/src/p2p/p2p_go_neg.c
@@ -220,6 +220,7 @@ int p2p_connect_send(struct p2p_data *p2p, struct p2p_d=
evice *dev)
 	p2p->go_neg_peer =3D dev;
 	dev->flags |=3D P2P_DEV_WAIT_GO_NEG_RESPONSE;
 	dev->connect_reqs++;
+	dev->go_neg_req_sent++;
 	if (p2p_send_action(p2p, freq, dev->info.p2p_device_addr,
 			    p2p->cfg->dev_addr, dev->info.p2p_device_addr,
 			    wpabuf_head(req), wpabuf_len(req), 200) < 0) {
--=20
1.7.4.1


Regards,
-Neeraj



More information about the HostAP mailing list