devinet.c (320424c7d44f54c18df9812fd7c45f6963524002) devinet.c (6126891c6d4f6f4ef50323d2020635ee255a796e)
1// SPDX-License-Identifier: GPL-2.0-or-later
2/*
3 * NET3 IP device support routines.
4 *
5 * Derived from the IP parts of dev.c 1.0.19
6 * Authors: Ross Biro
7 * Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
8 * Mark Evans, <evansmp@uhura.aston.ac.uk>

--- 201 unchanged lines hidden (view full) ---

210{
211}
212#endif
213
214/* Locks all the inet devices. */
215
216static struct in_ifaddr *inet_alloc_ifa(void)
217{
1// SPDX-License-Identifier: GPL-2.0-or-later
2/*
3 * NET3 IP device support routines.
4 *
5 * Derived from the IP parts of dev.c 1.0.19
6 * Authors: Ross Biro
7 * Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
8 * Mark Evans, <evansmp@uhura.aston.ac.uk>

--- 201 unchanged lines hidden (view full) ---

210{
211}
212#endif
213
214/* Locks all the inet devices. */
215
216static struct in_ifaddr *inet_alloc_ifa(void)
217{
218 return kzalloc(sizeof(struct in_ifaddr), GFP_KERNEL);
218 return kzalloc(sizeof(struct in_ifaddr), GFP_KERNEL_ACCOUNT);
219}
220
221static void inet_rcu_free_ifa(struct rcu_head *head)
222{
223 struct in_ifaddr *ifa = container_of(head, struct in_ifaddr, rcu_head);
224 if (ifa->ifa_dev)
225 in_dev_put(ifa->ifa_dev);
226 kfree(ifa);

--- 1723 unchanged lines hidden (view full) ---

1950};
1951
1952static int inet_validate_link_af(const struct net_device *dev,
1953 const struct nlattr *nla)
1954{
1955 struct nlattr *a, *tb[IFLA_INET_MAX+1];
1956 int err, rem;
1957
219}
220
221static void inet_rcu_free_ifa(struct rcu_head *head)
222{
223 struct in_ifaddr *ifa = container_of(head, struct in_ifaddr, rcu_head);
224 if (ifa->ifa_dev)
225 in_dev_put(ifa->ifa_dev);
226 kfree(ifa);

--- 1723 unchanged lines hidden (view full) ---

1950};
1951
1952static int inet_validate_link_af(const struct net_device *dev,
1953 const struct nlattr *nla)
1954{
1955 struct nlattr *a, *tb[IFLA_INET_MAX+1];
1956 int err, rem;
1957
1958 if (dev && !__in_dev_get_rcu(dev))
1958 if (dev && !__in_dev_get_rtnl(dev))
1959 return -EAFNOSUPPORT;
1960
1961 err = nla_parse_nested_deprecated(tb, IFLA_INET_MAX, nla,
1962 inet_af_policy, NULL);
1963 if (err < 0)
1964 return err;
1965
1966 if (tb[IFLA_INET_CONF]) {

--- 9 unchanged lines hidden (view full) ---

1976 }
1977
1978 return 0;
1979}
1980
1981static int inet_set_link_af(struct net_device *dev, const struct nlattr *nla,
1982 struct netlink_ext_ack *extack)
1983{
1959 return -EAFNOSUPPORT;
1960
1961 err = nla_parse_nested_deprecated(tb, IFLA_INET_MAX, nla,
1962 inet_af_policy, NULL);
1963 if (err < 0)
1964 return err;
1965
1966 if (tb[IFLA_INET_CONF]) {

--- 9 unchanged lines hidden (view full) ---

1976 }
1977
1978 return 0;
1979}
1980
1981static int inet_set_link_af(struct net_device *dev, const struct nlattr *nla,
1982 struct netlink_ext_ack *extack)
1983{
1984 struct in_device *in_dev = __in_dev_get_rcu(dev);
1984 struct in_device *in_dev = __in_dev_get_rtnl(dev);
1985 struct nlattr *a, *tb[IFLA_INET_MAX+1];
1986 int rem;
1987
1988 if (!in_dev)
1989 return -EAFNOSUPPORT;
1990
1991 if (nla_parse_nested_deprecated(tb, IFLA_INET_MAX, nla, NULL, NULL) < 0)
1992 return -EINVAL;

--- 786 unchanged lines hidden ---
1985 struct nlattr *a, *tb[IFLA_INET_MAX+1];
1986 int rem;
1987
1988 if (!in_dev)
1989 return -EAFNOSUPPORT;
1990
1991 if (nla_parse_nested_deprecated(tb, IFLA_INET_MAX, nla, NULL, NULL) < 0)
1992 return -EINVAL;

--- 786 unchanged lines hidden ---