Re: [PATCH] net: Fix potential memory leak in proto_register()

From: David Miller
Date: Tue Aug 11 2020 - 18:37:28 EST


From: Miaohe Lin <linmiaohe@xxxxxxxxxx>
Date: Mon, 10 Aug 2020 08:16:58 -0400

> 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: b45ce32135d1 ("sock: fix potential memory leak in proto_register()")
> Signed-off-by: Miaohe Lin <linmiaohe@xxxxxxxxxx>

Applied and queued up for -stable, thanks.