Skip to content

Commit

Permalink
net: sock: remove the unnecessary check in proto_register
Browse files Browse the repository at this point in the history
tw_prot_cleanup will check the twsk_prot.

Fixes: 0f5907a ("net: Fix potential memory leak in proto_register()")
Cc: Miaohe Lin <linmiaohe@huawei.com>
Signed-off-by: Tonghao Zhang <xiangxia.m.yue@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Tonghao Zhang authored and David S. Miller committed Apr 23, 2021
1 parent cad4162 commit ed744d8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion net/core/sock.c
Original file line number Diff line number Diff line change
Expand Up @@ -3531,7 +3531,7 @@ int proto_register(struct proto *prot, int alloc_slab)
return ret;

out_free_timewait_sock_slab:
if (alloc_slab && prot->twsk_prot)
if (alloc_slab)
tw_prot_cleanup(prot->twsk_prot);
out_free_request_sock_slab:
if (alloc_slab) {
Expand Down

0 comments on commit ed744d8

Please sign in to comment.