diff options
author | Andrei Emeltchenko <andrei.emeltchenko@intel.com> | 2012-02-14 08:12:57 -0500 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@intel.com> | 2012-02-16 08:15:08 -0500 |
commit | 7ddb6e0f3f7aa265c905b947e9ac4ab9562e52f2 (patch) | |
tree | c284114f6d8a77aecf0a00f8aae1ab54315597b7 /net/bluetooth/l2cap_sock.c | |
parent | 46479e698530b8197d601a23317b7c7654195338 (diff) |
Bluetooth: Do not dereference zero sk
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Diffstat (limited to 'net/bluetooth/l2cap_sock.c')
-rw-r--r-- | net/bluetooth/l2cap_sock.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/net/bluetooth/l2cap_sock.c b/net/bluetooth/l2cap_sock.c index 16360298590f..138fe3446678 100644 --- a/net/bluetooth/l2cap_sock.c +++ b/net/bluetooth/l2cap_sock.c | |||
@@ -795,7 +795,7 @@ static void l2cap_sock_kill(struct sock *sk) | |||
795 | static int l2cap_sock_shutdown(struct socket *sock, int how) | 795 | static int l2cap_sock_shutdown(struct socket *sock, int how) |
796 | { | 796 | { |
797 | struct sock *sk = sock->sk; | 797 | struct sock *sk = sock->sk; |
798 | struct l2cap_chan *chan = l2cap_pi(sk)->chan; | 798 | struct l2cap_chan *chan; |
799 | int err = 0; | 799 | int err = 0; |
800 | 800 | ||
801 | BT_DBG("sock %p, sk %p", sock, sk); | 801 | BT_DBG("sock %p, sk %p", sock, sk); |
@@ -803,6 +803,8 @@ static int l2cap_sock_shutdown(struct socket *sock, int how) | |||
803 | if (!sk) | 803 | if (!sk) |
804 | return 0; | 804 | return 0; |
805 | 805 | ||
806 | chan = l2cap_pi(sk)->chan; | ||
807 | |||
806 | lock_sock(sk); | 808 | lock_sock(sk); |
807 | if (!sk->sk_shutdown) { | 809 | if (!sk->sk_shutdown) { |
808 | if (chan->mode == L2CAP_MODE_ERTM) | 810 | if (chan->mode == L2CAP_MODE_ERTM) |