diff options
author | Dave Jones <davej@redhat.com> | 2011-04-19 23:36:59 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-04-19 23:36:59 -0400 |
commit | c6914a6f261aca0c9f715f883a353ae7ff51fe83 (patch) | |
tree | 05138f623ae01c13dbfeb5e9b38ae1b5e1bdde73 /net | |
parent | 0b0dc0f17f98b59772ca6380c7d5ce4cc593a974 (diff) |
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')
-rw-r--r-- | net/can/bcm.c | 7 |
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) | |||
1427 | static int bcm_release(struct socket *sock) | 1427 | static int bcm_release(struct socket *sock) |
1428 | { | 1428 | { |
1429 | struct sock *sk = sock->sk; | 1429 | struct sock *sk = sock->sk; |
1430 | struct bcm_sock *bo = bcm_sk(sk); | 1430 | struct bcm_sock *bo; |
1431 | struct bcm_op *op, *next; | 1431 | struct bcm_op *op, *next; |
1432 | 1432 | ||
1433 | if (sk == NULL) | ||
1434 | return 0; | ||
1435 | |||
1436 | bo = bcm_sk(sk); | ||
1437 | |||
1433 | /* remove bcm_ops, timer, rx_unregister(), etc. */ | 1438 | /* remove bcm_ops, timer, rx_unregister(), etc. */ |
1434 | 1439 | ||
1435 | unregister_netdevice_notifier(&bo->notifier); | 1440 | unregister_netdevice_notifier(&bo->notifier); |