]> git.baikalelectronics.ru Git - kernel.git/commit
net: Fix potential memory leak in proto_register()
authorMiaohe Lin <linmiaohe@huawei.com>
Mon, 10 Aug 2020 12:16:58 +0000 (08:16 -0400)
committerDavid S. Miller <davem@davemloft.net>
Tue, 11 Aug 2020 22:36:14 +0000 (15:36 -0700)
commita9197cca4e3740b2b8e5ddd2d4756d65bd3f7c13
tree0bc42a52e428f273b2ce6d0d68e85ea2402c0a1c
parentf69382d7acc162bfa5106d9d60c7489a61cc4697
net: Fix potential memory leak in proto_register()

If we failed to assign proto idx, we free the twsk_slab_name but forget to
free the twsk_slab. Add a helper function tw_prot_cleanup() to free these
together and also use this helper function in proto_unregister().

Fixes: ed01075a94bd ("sock: fix potential memory leak in proto_register()")
Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/core/sock.c