ipv4: icmp: use icmp_sk_exit()
authorKefeng Wang <wangkefeng.wang@huawei.com>
Sat, 23 Feb 2019 07:28:26 +0000 (15:28 +0800)
committerDavid S. Miller <davem@davemloft.net>
Mon, 25 Feb 2019 05:57:26 +0000 (21:57 -0800)
Simply use icmp_sk_exit() when inet_ctl_sock_create() fail in icmp_sk_init().

Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/icmp.c

index 065997f414e61e22a31e663f89bd642800cf72b4..364cfe5e414bb3aef2e49ca78d319dd8b7be4774 100644 (file)
@@ -1245,9 +1245,7 @@ static int __net_init icmp_sk_init(struct net *net)
        return 0;
 
 fail:
-       for_each_possible_cpu(i)
-               inet_ctl_sock_destroy(*per_cpu_ptr(net->ipv4.icmp_sk, i));
-       free_percpu(net->ipv4.icmp_sk);
+       icmp_sk_exit(net);
        return err;
 }