diff options
author | David S. Miller <davem@davemloft.net> | 2011-03-31 21:59:10 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-03-31 21:59:10 -0400 |
commit | c100c8f4c3c6f2a407bdbaaad2c4f1062e6a473a (patch) | |
tree | bc4075ba65a4187ca46642589f5299cde399ae22 /net | |
parent | c37947459172a02691ccd48cb967e8b605d38c56 (diff) |
appletalk: Fix OOPS in atalk_release().
Commit 60d9f461a20ba59219fdcdc30cbf8e3a4ad3f625 ("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 <davej@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/appletalk/ddp.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/net/appletalk/ddp.c b/net/appletalk/ddp.c index 206e771e82d1..956a5302002a 100644 --- a/net/appletalk/ddp.c +++ b/net/appletalk/ddp.c | |||
@@ -1051,16 +1051,17 @@ static int atalk_release(struct socket *sock) | |||
1051 | { | 1051 | { |
1052 | struct sock *sk = sock->sk; | 1052 | struct sock *sk = sock->sk; |
1053 | 1053 | ||
1054 | sock_hold(sk); | ||
1055 | lock_sock(sk); | ||
1056 | if (sk) { | 1054 | if (sk) { |
1055 | sock_hold(sk); | ||
1056 | lock_sock(sk); | ||
1057 | |||
1057 | sock_orphan(sk); | 1058 | sock_orphan(sk); |
1058 | sock->sk = NULL; | 1059 | sock->sk = NULL; |
1059 | atalk_destroy_socket(sk); | 1060 | atalk_destroy_socket(sk); |
1060 | } | ||
1061 | release_sock(sk); | ||
1062 | sock_put(sk); | ||
1063 | 1061 | ||
1062 | release_sock(sk); | ||
1063 | sock_put(sk); | ||
1064 | } | ||
1064 | return 0; | 1065 | return 0; |
1065 | } | 1066 | } |
1066 | 1067 | ||