Skip to contentSkip to conversation

sock.c: potential null dereference

PATCH Applied Dan Carpenter 2 participants 2 messages Mar 6, 2010 – Mar 7, 2010

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sock.c: potential null dereference

We test that "prot->rsk_prot" is non-null right before we dereference it on this line.

net/core/sock.c +2 -1
index fcd397a..fa427b5 100644
@@ -2276,7 +2276,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;