addrconf.c (b52e1cce31ca721e937d517411179f9196ee6135) | addrconf.c (425b9c7f51c98443db71ad679893725483b21196) |
---|---|
1// SPDX-License-Identifier: GPL-2.0-or-later 2/* 3 * IPv6 Address [auto]configuration 4 * Linux INET6 implementation 5 * 6 * Authors: 7 * Pedro Roque <roque@di.fc.ul.pt> 8 * Alexey Kuznetsov <kuznet@ms2.inr.ac.ru> --- 321 unchanged lines hidden (view full) --- 330 if (mod_delayed_work(addrconf_wq, &ifp->dad_work, delay)) 331 in6_ifa_put(ifp); 332} 333 334static int snmp6_alloc_dev(struct inet6_dev *idev) 335{ 336 int i; 337 | 1// SPDX-License-Identifier: GPL-2.0-or-later 2/* 3 * IPv6 Address [auto]configuration 4 * Linux INET6 implementation 5 * 6 * Authors: 7 * Pedro Roque <roque@di.fc.ul.pt> 8 * Alexey Kuznetsov <kuznet@ms2.inr.ac.ru> --- 321 unchanged lines hidden (view full) --- 330 if (mod_delayed_work(addrconf_wq, &ifp->dad_work, delay)) 331 in6_ifa_put(ifp); 332} 333 334static int snmp6_alloc_dev(struct inet6_dev *idev) 335{ 336 int i; 337 |
338 idev->stats.ipv6 = alloc_percpu(struct ipstats_mib); | 338 idev->stats.ipv6 = alloc_percpu_gfp(struct ipstats_mib, GFP_KERNEL_ACCOUNT); |
339 if (!idev->stats.ipv6) 340 goto err_ip; 341 342 for_each_possible_cpu(i) { 343 struct ipstats_mib *addrconf_stats; 344 addrconf_stats = per_cpu_ptr(idev->stats.ipv6, i); 345 u64_stats_init(&addrconf_stats->syncp); 346 } 347 348 349 idev->stats.icmpv6dev = kzalloc(sizeof(struct icmpv6_mib_device), 350 GFP_KERNEL); 351 if (!idev->stats.icmpv6dev) 352 goto err_icmp; 353 idev->stats.icmpv6msgdev = kzalloc(sizeof(struct icmpv6msg_mib_device), | 339 if (!idev->stats.ipv6) 340 goto err_ip; 341 342 for_each_possible_cpu(i) { 343 struct ipstats_mib *addrconf_stats; 344 addrconf_stats = per_cpu_ptr(idev->stats.ipv6, i); 345 u64_stats_init(&addrconf_stats->syncp); 346 } 347 348 349 idev->stats.icmpv6dev = kzalloc(sizeof(struct icmpv6_mib_device), 350 GFP_KERNEL); 351 if (!idev->stats.icmpv6dev) 352 goto err_icmp; 353 idev->stats.icmpv6msgdev = kzalloc(sizeof(struct icmpv6msg_mib_device), |
354 GFP_KERNEL); | 354 GFP_KERNEL_ACCOUNT); |
355 if (!idev->stats.icmpv6msgdev) 356 goto err_icmpmsg; 357 358 return 0; 359 360err_icmpmsg: 361 kfree(idev->stats.icmpv6dev); 362err_icmp: --- 7 unchanged lines hidden (view full) --- 370 struct inet6_dev *ndev; 371 int err = -ENOMEM; 372 373 ASSERT_RTNL(); 374 375 if (dev->mtu < IPV6_MIN_MTU && dev != blackhole_netdev) 376 return ERR_PTR(-EINVAL); 377 | 355 if (!idev->stats.icmpv6msgdev) 356 goto err_icmpmsg; 357 358 return 0; 359 360err_icmpmsg: 361 kfree(idev->stats.icmpv6dev); 362err_icmp: --- 7 unchanged lines hidden (view full) --- 370 struct inet6_dev *ndev; 371 int err = -ENOMEM; 372 373 ASSERT_RTNL(); 374 375 if (dev->mtu < IPV6_MIN_MTU && dev != blackhole_netdev) 376 return ERR_PTR(-EINVAL); 377 |
378 ndev = kzalloc(sizeof(struct inet6_dev), GFP_KERNEL); | 378 ndev = kzalloc(sizeof(*ndev), GFP_KERNEL_ACCOUNT); |
379 if (!ndev) 380 return ERR_PTR(err); 381 382 rwlock_init(&ndev->lock); 383 ndev->dev = dev; 384 INIT_LIST_HEAD(&ndev->addr_list); 385 timer_setup(&ndev->rs_timer, addrconf_rs_timer, 0); 386 memcpy(&ndev->cnf, dev_net(dev)->ipv6.devconf_dflt, sizeof(ndev->cnf)); --- 6668 unchanged lines hidden (view full) --- 7055 7056static int __addrconf_sysctl_register(struct net *net, char *dev_name, 7057 struct inet6_dev *idev, struct ipv6_devconf *p) 7058{ 7059 int i, ifindex; 7060 struct ctl_table *table; 7061 char path[sizeof("net/ipv6/conf/") + IFNAMSIZ]; 7062 | 379 if (!ndev) 380 return ERR_PTR(err); 381 382 rwlock_init(&ndev->lock); 383 ndev->dev = dev; 384 INIT_LIST_HEAD(&ndev->addr_list); 385 timer_setup(&ndev->rs_timer, addrconf_rs_timer, 0); 386 memcpy(&ndev->cnf, dev_net(dev)->ipv6.devconf_dflt, sizeof(ndev->cnf)); --- 6668 unchanged lines hidden (view full) --- 7055 7056static int __addrconf_sysctl_register(struct net *net, char *dev_name, 7057 struct inet6_dev *idev, struct ipv6_devconf *p) 7058{ 7059 int i, ifindex; 7060 struct ctl_table *table; 7061 char path[sizeof("net/ipv6/conf/") + IFNAMSIZ]; 7062 |
7063 table = kmemdup(addrconf_sysctl, sizeof(addrconf_sysctl), GFP_KERNEL); | 7063 table = kmemdup(addrconf_sysctl, sizeof(addrconf_sysctl), GFP_KERNEL_ACCOUNT); |
7064 if (!table) 7065 goto out; 7066 7067 for (i = 0; table[i].data; i++) { 7068 table[i].data += (char *)p - (char *)&ipv6_devconf; 7069 /* If one of these is already set, then it is not safe to 7070 * overwrite either of them: this makes proc_dointvec_minmax 7071 * usable. --- 309 unchanged lines hidden --- | 7064 if (!table) 7065 goto out; 7066 7067 for (i = 0; table[i].data; i++) { 7068 table[i].data += (char *)p - (char *)&ipv6_devconf; 7069 /* If one of these is already set, then it is not safe to 7070 * overwrite either of them: this makes proc_dointvec_minmax 7071 * usable. --- 309 unchanged lines hidden --- |