From: Sudha Bheemanna Date: Mon, 12 Sep 2016 06:27:38 +0000 (+0530) Subject: Bluetooth: check sock parent before unlink X-Git-Tag: submit/tizen/20161216.052309~144 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ecf6bb40876e428006439547c75e55555bb8eaf9;p=platform%2Fkernel%2Flinux-exynos.git Bluetooth: check sock parent before unlink Add a check for BT socket before using it to unlink in bt_accept_unlink(). This helps to avoid kernel panic. Change-Id: Ie8919dedce239a3476c06ad48ebb3a0f731b9856 Signed-off-by: Sudha Bheemanna [update patch title] Signed-off-by: Seung-Woo Kim --- diff --git a/net/bluetooth/af_bluetooth.c b/net/bluetooth/af_bluetooth.c index 70f9d945faf7..525ad0f1239d 100644 --- a/net/bluetooth/af_bluetooth.c +++ b/net/bluetooth/af_bluetooth.c @@ -189,12 +189,18 @@ struct sock *bt_accept_dequeue(struct sock *parent, struct socket *newsock) /* FIXME: Is this check still needed */ if (sk->sk_state == BT_CLOSED) { release_sock(sk); +#ifdef TIZEN_BT + if (bt_sk(sk)->parent) +#endif bt_accept_unlink(sk); continue; } if (sk->sk_state == BT_CONNECTED || !newsock || test_bit(BT_SK_DEFER_SETUP, &bt_sk(parent)->flags)) { +#ifdef TIZEN_BT + if (bt_sk(sk)->parent) +#endif bt_accept_unlink(sk); if (newsock) sock_graft(sk, newsock);