summaryrefslogtreecommitdiffstats
path: root/net/can/bcm.c
diff options
context:
space:
mode:
authorDave Jones <davej@redhat.com>2011-04-20 05:36:59 +0200
committerDavid S. Miller <davem@davemloft.net>2011-04-20 05:36:59 +0200
commitc6914a6f261aca0c9f715f883a353ae7ff51fe83 (patch)
tree05138f623ae01c13dbfeb5e9b38ae1b5e1bdde73 /net/can/bcm.c
parentMerge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/kaber/... (diff)
downloadlinux-c6914a6f261aca0c9f715f883a353ae7ff51fe83.tar.xz
linux-c6914a6f261aca0c9f715f883a353ae7ff51fe83.zip
can: Add missing socket check in can/bcm release.
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>
Diffstat (limited to 'net/can/bcm.c')
-rw-r--r--net/can/bcm.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/net/can/bcm.c b/net/can/bcm.c
index 57b1aed79014..8a6a05e7c3c8 100644
--- a/net/can/bcm.c
+++ b/net/can/bcm.c
@@ -1427,9 +1427,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);