Re: [PATCH v2] sock: fix potential memory leak in proto_register()

2019-08-22 Thread David Miller
From: zhanglin Date: Wed, 21 Aug 2019 08:42:38 +0800 > @@ -3243,18 +3245,24 @@ int proto_register(struct proto *prot, int alloc_slab) > } > > mutex_lock(&proto_list_mutex); > + if (assign_proto_idx(prot)) { > + mutex_unlock(&proto_list_mutex); > + goto ou

[PATCH v2] sock: fix potential memory leak in proto_register()

2019-08-20 Thread zhanglin
If protocols registered exceeded PROTO_INUSE_NR, prot will be added to proto_list, but no available bit left for prot in proto_inuse_idx. Signed-off-by: zhanglin --- net/core/sock.c | 24 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/net/core/sock.c b/ne