Skip to content

Commit

Permalink
appletalk: Fix OOPS in atalk_release().
Browse files Browse the repository at this point in the history
Commit 60d9f46 ("appletalk: remove
the BKL") added a dereference of "sk" before checking for NULL in
atalk_release().

Guard the code block completely, rather than partially, with the
NULL check.

Reported-by: Dave Jones <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
davem330 committed Apr 1, 2011
1 parent c379474 commit c100c8f
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions net/appletalk/ddp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1051,16 +1051,17 @@ static int atalk_release(struct socket *sock)
{
struct sock *sk = sock->sk;

sock_hold(sk);
lock_sock(sk);
if (sk) {
sock_hold(sk);
lock_sock(sk);

sock_orphan(sk);
sock->sk = NULL;
atalk_destroy_socket(sk);
}
release_sock(sk);
sock_put(sk);

release_sock(sk);
sock_put(sk);
}
return 0;
}

Expand Down

0 comments on commit c100c8f

Please sign in to comment.