aboutsummaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorDave Jones <davej@redhat.com>2011-04-19 20:36:59 -0700
committerGreg Kroah-Hartman <gregkh@suse.de>2011-05-09 16:04:45 -0700
commitb3d1367fc84ddadeca6540f47ebbb2f31328dfcc (patch)
tree030095c233423027c1986fb2331d100ec41fd9fd /net
parent526253456ad4e2b2136d470e651b1a400942a5db (diff)
can: Add missing socket check in can/bcm release.
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>
Diffstat (limited to 'net')
-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 3c03cb00b79..f7ae8d37cf2 100644
--- a/net/can/bcm.c
+++ b/net/can/bcm.c
@@ -1412,9 +1412,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);