Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c100c8f4 authored by David S. Miller's avatar David S. Miller
Browse files

appletalk: Fix OOPS in atalk_release().



Commit 60d9f461 ("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: default avatarDave Jones <davej@redhat.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent c3794745
Loading
Loading
Loading
Loading
+6 −5
Original line number Diff line number Diff line
@@ -1051,16 +1051,17 @@ static int atalk_release(struct socket *sock)
{
	struct sock *sk = sock->sk;

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

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

		release_sock(sk);
		sock_put(sk);

	}
	return 0;
}