]> git.baikalelectronics.ru Git - kernel.git/commit
dccp: Fix possible memleak in dccp_init and dccp_fini
authorWang Hai <wanghai38@huawei.com>
Tue, 9 Jun 2020 14:18:16 +0000 (22:18 +0800)
committerDavid S. Miller <davem@davemloft.net>
Tue, 9 Jun 2020 20:26:23 +0000 (13:26 -0700)
commit6b1773cb75d5754bc6054a2056ef91da0d6cc4b3
tree117d45f01a2bbbebf6b8fd2158686d9133a2afa6
parente454c21b86a24977523ea418d1d1f2c2495fde21
dccp: Fix possible memleak in dccp_init and dccp_fini

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: 12de814ae827 ("net: dccp: fix kernel crash on module load")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Wang Hai <wanghai38@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/inet_hashtables.h
net/dccp/proto.c