]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
can: Add missing socket check in can/bcm release.
authorDave Jones <davej@redhat.com>
Wed, 20 Apr 2011 03:36:59 +0000 (20:36 -0700)
committerGreg Kroah-Hartman <gregkh@suse.de>
Mon, 9 May 2011 22:55:00 +0000 (15:55 -0700)
commit c6914a6f261aca0c9f715f883a353ae7ff51fe83 upstream.

We can get here with a NULL socket argument passed from userspace,
so we need to handle it accordingly.

Signed-off-by: Dave Jones <davej@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
net/can/bcm.c

index 029dcc2b323ba5bbcc3218765e47f9c00ffd0634..2ffd2e01dc5225656c91a45f94313bd7be6b5cf7 100644 (file)
@@ -1425,9 +1425,14 @@ static int bcm_init(struct sock *sk)
 static int bcm_release(struct socket *sock)
 {
        struct sock *sk = sock->sk;
-       struct bcm_sock *bo = bcm_sk(sk);
+       struct bcm_sock *bo;
        struct bcm_op *op, *next;
 
+       if (sk == NULL)
+               return 0;
+
+       bo = bcm_sk(sk);
+
        /* remove bcm_ops, timer, rx_unregister(), etc. */
 
        unregister_netdevice_notifier(&bo->notifier);