Commit 1824f340 authored by Marcel Holtmann's avatar Marcel Holtmann

[Bluetooth] Fix race for incoming connections

This patch fixes a racing condition in accepting incoming RFCOMM
connections. If a SABM command frame occurs in data packet right
after L2CAP configuration request packet and there is no active
session yet then the kernel RFCOMM thread wakes up only once and
creates a new session. But it does not process SABM frame from
second data packet waiting in the queue. Connection setup hangs
and the other side is waiting for UA frame response, but the
kernel thread keeps sleeping. A possible solution is to force
additional thread wakeup right after successful creation of the
new session.

Patch from Dmitri Khokhlov <dkhokhlov@hotmail.com>
parent 1f4e5444
......@@ -1663,9 +1663,10 @@ static inline void rfcomm_accept_connection(struct rfcomm_session *s)
nsock->sk->sk_state_change = rfcomm_l2state_change;
s = rfcomm_session_add(nsock, BT_OPEN);
if (s)
if (s) {
rfcomm_session_hold(s);
else
rfcomm_schedule(RFCOMM_SCHED_RX);
} else
sock_release(nsock);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment