Эх сурвалжийг харах

[SOCK]: on failure free the sock from the right place

Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Arnaldo Carvalho de Melo 20 жил өмнө
parent
commit
88a6685825
1 өөрчлөгдсөн 4 нэмэгдсэн , 1 устгасан
  1. 4 1
      net/core/sock.c

+ 4 - 1
net/core/sock.c

@@ -641,7 +641,10 @@ struct sock *sk_alloc(int family, int priority, struct proto *prot, int zero_it)
 		}
 		}
 		
 		
 		if (security_sk_alloc(sk, family, priority)) {
 		if (security_sk_alloc(sk, family, priority)) {
-			kmem_cache_free(slab, sk);
+			if (slab != NULL)
+				kmem_cache_free(slab, sk);
+			else
+				kfree(sk);
 			sk = NULL;
 			sk = NULL;
 		} else
 		} else
 			__module_get(prot->owner);
 			__module_get(prot->owner);