Explorar o código

[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 %!s(int64=20) %!d(string=hai) anos
pai
achega
88a6685825
Modificáronse 1 ficheiros con 4 adicións e 1 borrados
  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)) {
-			kmem_cache_free(slab, sk);
+			if (slab != NULL)
+				kmem_cache_free(slab, sk);
+			else
+				kfree(sk);
 			sk = NULL;
 		} else
 			__module_get(prot->owner);