From 0dc1f56ecbca87dc4243cec2280b3b31e0456cd3 Mon Sep 17 00:00:00 2001 From: Octavian Purdila Date: Fri, 27 Jan 2012 19:32:39 +0200 Subject: [PATCH] --- yaml --- r: 290907 b: refs/heads/master c: 66f01296962dfebf032c18ffe61c53a199b4a7bd h: refs/heads/master i: 290905: b0e39930a646d375df3e1fc0045d994095dd0e8a 290903: 4964dbe583acb7b57186731a16e2ee29c5be7e4a v: v3 --- [refs] | 2 +- trunk/net/bluetooth/rfcomm/core.c | 18 ++++++++++++------ 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/[refs] b/[refs] index b6a845b795ef..d68466ebdb8b 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 4777bfdebbddc1f58d9148de5a3e00375d063768 +refs/heads/master: 66f01296962dfebf032c18ffe61c53a199b4a7bd diff --git a/trunk/net/bluetooth/rfcomm/core.c b/trunk/net/bluetooth/rfcomm/core.c index 501649bf5596..8a602388f1e7 100644 --- a/trunk/net/bluetooth/rfcomm/core.c +++ b/trunk/net/bluetooth/rfcomm/core.c @@ -1164,12 +1164,18 @@ static int rfcomm_recv_ua(struct rfcomm_session *s, u8 dlci) break; case BT_DISCONN: - /* 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) - if (list_empty(&s->dlcs)) - rfcomm_session_put(s); + /* rfcomm_session_put is called later so don't do + * anything here otherwise we will mess up the session + * reference counter: + * + * (a) when we are the initiator dlc_unlink will drive + * the reference counter to 0 (there is no initial put + * after session_add) + * + * (b) when we are not the initiator rfcomm_rx_process + * will explicitly call put to balance the initial hold + * done after session add. + */ break; } }