Subject: Too late check in af_packet.c

From: Dave Jones <[email-masked]>
Date: Fri, 3 Sep 2004 21:52:06 +0100

Using the automated source checker at coverity.com, they picked up
on some code in packet_release() where a NULL check was done
after dereferencing.  Patch below.

Signed-off-by: Dave Jones <[email-masked]>

		Dave

--- linux-2.6.8/net/packet/af_packet.c~	2004-09-03 21:48:14.653433072 +0100
+++ linux-2.6.8/net/packet/af_packet.c	2004-09-03 21:49:23.652943552 +0100
@@ -785,11 +785,13 @@
 static int packet_release(struct socket *sock)
 {
 	struct sock *sk = sock->sk;
-	struct packet_opt *po = pkt_sk(sk);
+	struct packet_opt *po;
 
 	if (!sk)
 		return 0;
 
+	po = pkt_sk(sk);
+
 	write_lock_bh(&packet_sklist_lock);
 	sk_del_node_init(sk);
 	write_unlock_bh(&packet_sklist_lock);