P2P: Address race condition with GO Negotiation Request TX status
authorNeeraj Kumar Garg <neerajkg@broadcom.com>
Sat, 9 Jun 2012 15:03:47 +0000 (18:03 +0300)
committerJouni Malinen <j@w1.fi>
Sat, 9 Jun 2012 15:03:47 +0000 (18:03 +0300)
commita1d2ab329e839838a623e1dd8c9fc77e97cd6355
tree056652540de8467204ed7c3fa7c8ca6dee173aa6
parentdada954ad7515f6f85d489aef43bea2ae2e8df04
P2P: Address race condition with GO Negotiation Request TX status

If both peers initiate GO Negotiation at about the same time, it is
possible for the GO Negotiation Request frame from the peer to be
received between the local attempt to send the GO Negotiation Request
and TX status event for that. This could result in both devices sending
GO Negotiation Response frames even though one of them should have
skipped this based which device uses a higher MAC address.

Resolve this race by incrementing go_neg_req_sent when p2p_send_action()
returns success instead of doing this from the TX status callback. If
the frame is not acknowledged, go_neg_req_sent is cleared in TX status
handler.

Signed-off-by: Neeraj Garg <neerajkg@broadcom.com>
src/p2p/p2p.c
src/p2p/p2p_go_neg.c