net: Fix memory leak in the proto_register function
If the slub allocator is used, kmem_cache_create() may merge two or more kmem_cache's into one but the cache name pointer is not updated and kmem_cache_name() is no longer guaranteed to return the pointer passed to the former function. This patch stores the kmalloc'ed pointers in the corresponding request_sock_ops and timewait_sock_ops structures. Signed-off-by: Catalin Marinas <catalin.marinas@arm.com> Acked-by: Arnaldo Carvalho de Melo <acme@redhat.com> Reviewed-by: Christoph Lameter <cl@linux-foundation.org> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
33cf71cee1
commit
7e56b5d698
@@ -16,6 +16,7 @@
|
||||
|
||||
struct timewait_sock_ops {
|
||||
struct kmem_cache *twsk_slab;
|
||||
char *twsk_slab_name;
|
||||
unsigned int twsk_obj_size;
|
||||
int (*twsk_unique)(struct sock *sk,
|
||||
struct sock *sktw, void *twp);
|
||||
|
Reference in New Issue
Block a user