]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
net: rtnetlink: unify the code in __rtnl_newlink get dev with the rest
authorJiri Pirko <jiri@mellanox.com>
Mon, 30 Sep 2019 09:48:18 +0000 (11:48 +0200)
committerDavid S. Miller <davem@davemloft.net>
Tue, 1 Oct 2019 21:47:19 +0000 (14:47 -0700)
__rtnl_newlink() code flow is a bit different around tb[IFLA_IFNAME]
processing comparing to the other places. Change that to be unified with
the rest.

Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/core/rtnetlink.c

index c38917371b84e21d7db49209b8a2e89aa22014d0..a0017737442f7f5a5f62ef27c717b123aeded0bb 100644 (file)
@@ -3080,12 +3080,10 @@ replay:
        ifm = nlmsg_data(nlh);
        if (ifm->ifi_index > 0)
                dev = __dev_get_by_index(net, ifm->ifi_index);
-       else {
-               if (ifname[0])
-                       dev = __dev_get_by_name(net, ifname);
-               else
-                       dev = NULL;
-       }
+       else if (tb[IFLA_IFNAME])
+               dev = __dev_get_by_name(net, ifname);
+       else
+               dev = NULL;
 
        if (dev) {
                master_dev = netdev_master_upper_dev_get(dev);