Commit 0c5b8d8a authored by Dave Jones's avatar Dave Jones Committed by Patrick McHardy

[PACKET]: Fix deref before NULL check in packet_release()

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: default avatarDave Jones <davej@redhat.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 2f122062
......@@ -786,11 +786,13 @@ static int packet_sendmsg(struct kiocb *iocb, struct socket *sock,
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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment