]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
Revert "rtnetlink: Reject negative ifindexes in RTM_NEWLINK"
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 9 Oct 2023 18:25:00 +0000 (20:25 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 10 Oct 2023 19:43:42 +0000 (21:43 +0200)
This reverts commit 69197b2b2a7bcf92b209490639316af5dc751cc0 which is
commit 30188bd7838c16a98a520db1fe9df01ffc6ed368 upstream.

It was improperly backported to 4.14.y, and applied to the wrong
function, which obviously causes problems.  A fixed version will be
applied as a separate commit later.

Reported-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Link: https://lore.kernel.org/r/ZSQeA8fhUT++iZvz@ostr-mac
Cc: Ido Schimmel <idosch@nvidia.com>
Cc: Jiri Pirko <jiri@nvidia.com>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: Paolo Abeni <pabeni@redhat.com>
Cc: Sasha Levin <sashal@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/core/rtnetlink.c

index 0478f8cddd961bb48fa7f0ebc932857d209f4b73..a76f3024687f026fcbb8b5c6de908177095cd996 100644 (file)
@@ -2311,10 +2311,7 @@ static int rtnl_setlink(struct sk_buff *skb, struct nlmsghdr *nlh,
        ifm = nlmsg_data(nlh);
        if (ifm->ifi_index > 0)
                dev = __dev_get_by_index(net, ifm->ifi_index);
-       else if (ifm->ifi_index < 0) {
-               NL_SET_ERR_MSG(extack, "ifindex can't be negative");
-               return -EINVAL;
-       } else if (tb[IFLA_IFNAME])
+       else if (tb[IFLA_IFNAME])
                dev = __dev_get_by_name(net, ifname);
        else
                goto errout;