aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth_mgmt/rfcomm/core.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/bluetooth_mgmt/rfcomm/core.c')
-rw-r--r--net/bluetooth_mgmt/rfcomm/core.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/net/bluetooth_mgmt/rfcomm/core.c b/net/bluetooth_mgmt/rfcomm/core.c
index c543fda..9e77543 100644
--- a/net/bluetooth_mgmt/rfcomm/core.c
+++ b/net/bluetooth_mgmt/rfcomm/core.c
@@ -1173,9 +1173,11 @@ static int rfcomm_recv_ua(struct rfcomm_session *s, u8 dlci)
/* When socket is closed and we are not RFCOMM
* initiator rfcomm_process_rx already calls
* rfcomm_session_put() */
- if (s->sock->sk->sk_state != BT_CLOSED && !s->initiator)
- if (list_empty(&s->dlcs))
+ if (s->sock->sk->sk_state != BT_CLOSED && s->acceptor_inc)
+ if (list_empty(&s->dlcs)) {
rfcomm_session_put(s);
+ s->acceptor_inc = 0;
+ }
break;
}
}
@@ -1871,9 +1873,10 @@ static inline void rfcomm_process_rx(struct rfcomm_session *s)
}
if (sk->sk_state == BT_CLOSED) {
- if (!s->initiator)
+ if (s->acceptor_inc) {
rfcomm_session_put(s);
-
+ s->acceptor_inc = 0;
+ }
rfcomm_session_close(s, sk->sk_err);
}
}
@@ -1901,6 +1904,7 @@ static inline void rfcomm_accept_connection(struct rfcomm_session *s)
s = rfcomm_session_add(nsock, BT_OPEN);
if (s) {
rfcomm_session_hold(s);
+ s->acceptor_inc = 1;
/* We should adjust MTU on incoming sessions.
* L2CAP MTU minus UIH header and FCS. */