提交 6ea3c9d5 编写于 作者: N Nikolay Aleksandrov 提交者: David S. Miller

mpls: fix mpls_net_init memory leak

Fix a memory leak in the mpls netns init function in case of failure. If
register_net_sysctl fails then we need to free the ctl_table.

Fixes: 7720c01f ("mpls: Add a sysctl to control the size of the mpls label table")
Signed-off-by: NNikolay Aleksandrov <nikolay@cumulusnetworks.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 f0fa6e52
......@@ -1177,8 +1177,10 @@ static int mpls_net_init(struct net *net)
table[0].data = net;
net->mpls.ctl = register_net_sysctl(net, "net/mpls", table);
if (net->mpls.ctl == NULL)
if (net->mpls.ctl == NULL) {
kfree(table);
return -ENOMEM;
}
return 0;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册