rtnetlink.c (5d26cff5bdbebdf98ba48217c078ff102536f134) rtnetlink.c (155fb43b70b5fce341347a77d1af2765d1e8fbb8)
1// SPDX-License-Identifier: GPL-2.0-or-later
2/*
3 * INET An implementation of the TCP/IP protocol suite for the LINUX
4 * operating system. INET is implemented using the BSD Socket
5 * interface as the means of communication with the user level.
6 *
7 * Routing netlink socket interface: protocol independent part.
8 *

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

3647
3648 return err;
3649}
3650
3651static int rtnl_alt_ifname(int cmd, struct net_device *dev, struct nlattr *attr,
3652 bool *changed, struct netlink_ext_ack *extack)
3653{
3654 char *alt_ifname;
1// SPDX-License-Identifier: GPL-2.0-or-later
2/*
3 * INET An implementation of the TCP/IP protocol suite for the LINUX
4 * operating system. INET is implemented using the BSD Socket
5 * interface as the means of communication with the user level.
6 *
7 * Routing netlink socket interface: protocol independent part.
8 *

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

3647
3648 return err;
3649}
3650
3651static int rtnl_alt_ifname(int cmd, struct net_device *dev, struct nlattr *attr,
3652 bool *changed, struct netlink_ext_ack *extack)
3653{
3654 char *alt_ifname;
3655 size_t size;
3655 int err;
3656
3657 err = nla_validate(attr, attr->nla_len, IFLA_MAX, ifla_policy, extack);
3658 if (err)
3659 return err;
3660
3656 int err;
3657
3658 err = nla_validate(attr, attr->nla_len, IFLA_MAX, ifla_policy, extack);
3659 if (err)
3660 return err;
3661
3662 if (cmd == RTM_NEWLINKPROP) {
3663 size = rtnl_prop_list_size(dev);
3664 size += nla_total_size(ALTIFNAMSIZ);
3665 if (size >= U16_MAX) {
3666 NL_SET_ERR_MSG(extack,
3667 "effective property list too long");
3668 return -EINVAL;
3669 }
3670 }
3671
3661 alt_ifname = nla_strdup(attr, GFP_KERNEL_ACCOUNT);
3662 if (!alt_ifname)
3663 return -ENOMEM;
3664
3665 if (cmd == RTM_NEWLINKPROP) {
3666 err = netdev_name_node_alt_create(dev, alt_ifname);
3667 if (!err)
3668 alt_ifname = NULL;

--- 2436 unchanged lines hidden ---
3672 alt_ifname = nla_strdup(attr, GFP_KERNEL_ACCOUNT);
3673 if (!alt_ifname)
3674 return -ENOMEM;
3675
3676 if (cmd == RTM_NEWLINKPROP) {
3677 err = netdev_name_node_alt_create(dev, alt_ifname);
3678 if (!err)
3679 alt_ifname = NULL;

--- 2436 unchanged lines hidden ---