sock.c: potential null dereference
authorDan Carpenter <error27@gmail.com>
Sat, 6 Mar 2010 01:04:45 +0000 (01:04 +0000)
committerDavid S. Miller <davem@davemloft.net>
Sun, 7 Mar 2010 23:25:50 +0000 (15:25 -0800)
We test that "prot->rsk_prot" is non-null right before we dereference it
on this line.

Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/core/sock.c

index 61a65a2..c5812bb 100644 (file)
@@ -2288,7 +2288,8 @@ out_free_request_sock_slab:
                prot->rsk_prot->slab = NULL;
        }
 out_free_request_sock_slab_name:
-       kfree(prot->rsk_prot->slab_name);
+       if (prot->rsk_prot)
+               kfree(prot->rsk_prot->slab_name);
 out_free_sock_slab:
        kmem_cache_destroy(prot->slab);
        prot->slab = NULL;