Skip to content

Commit

Permalink
can: Add missing socket check in can/bcm release.
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Dave Jones authored and davem330 committed Apr 20, 2011
1 parent 0b0dc0f commit c6914a6
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion net/can/bcm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit c6914a6

Please sign in to comment.