Skip to contentSkip to conversation

Too late check in af_packet.c

PATCH Dave Jones 2 participants 2 messages Sep 3, 2004 – Sep 7, 2004

Subsystems (3)
lore
Share & tools
lore

Dave Jones

author
#0 lore raw

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.

Dave

net/packet/af_packet.c renamed from net/packet/af_packet.c~ +3 -1
@@ -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);
maintainer
#1 lore raw
Quoted 5 lines · On Fri, 3 Sep 2004 21:52:06 +0100 Dave Jones <[email protected]> wrote:

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.

Looks great, applied.

Thanks.