Re: [PATCH] dccp: Fix possible memleak in dccp_init and dccp_fini

From: David Miller
Date: Tue Jun 09 2020 - 16:27:40 EST


From: Wang Hai <wanghai38@xxxxxxxxxx>
Date: Tue, 9 Jun 2020 22:18:16 +0800

> There are some memory leaks in dccp_init() and dccp_fini().
>
> In dccp_fini() and the error handling path in dccp_init(), free lhash2
> is missing. Add inet_hashinfo2_free_mod() to do it.
>
> If inet_hashinfo2_init_mod() failed in dccp_init(),
> percpu_counter_destroy() should be called to destroy dccp_orphan_count.
> It need to goto out_free_percpu when inet_hashinfo2_init_mod() failed.
>
> Fixes: c92c81df93df ("net: dccp: fix kernel crash on module load")
> Reported-by: Hulk Robot <hulkci@xxxxxxxxxx>
> Signed-off-by: Wang Hai <wanghai38@xxxxxxxxxx>

Applied and queued up for -stable, thank you.