From: Andrei Emeltchenko <andrei.emeltchenko@xxxxxxxxx> Handle BT_CLOSED state change by removing AMP manager. Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@xxxxxxxxx> --- net/bluetooth/a2mp.c | 17 ++++++++++++++++- 1 files changed, 16 insertions(+), 1 deletions(-) diff --git a/net/bluetooth/a2mp.c b/net/bluetooth/a2mp.c index e7b7534..21fae45 100644 --- a/net/bluetooth/a2mp.c +++ b/net/bluetooth/a2mp.c @@ -114,8 +114,23 @@ static void state_change_worker(struct work_struct *w) { struct a2mp_work_state_change *work = (struct a2mp_work_state_change *) w; struct sock *sk = work->sk; + struct amp_mgr *mgr = NULL; - BT_DBG("sk %p", sk); + mgr = get_amp_mgr_sk(sk); + if (!mgr) + goto out; + + BT_DBG("sk %p mgr %p state %d", sk, mgr, sk->sk_state); + + switch (sk->sk_state) { + case BT_CLOSED: + amp_mgr_put(mgr); + break; + } + + amp_mgr_put(mgr); + +out: sock_put(work->sk); kfree(work); } -- 1.7.4.1 -- To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html