summaryrefslogtreecommitdiffstats
path: root/net/core
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-10-09 20:25:00 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-10-10 21:45:02 +0200
commit88f8a01c42535285bcf2666d1f7eb9ada0de88cc (patch)
tree93d74ca6e95b9270f8a87ef9df608abcc8018ef9 /net/core
parent62c218124fe58372e0e1f60d5b634d21c264b337 (diff)
downloadlinux-stable-88f8a01c42535285bcf2666d1f7eb9ada0de88cc.tar.gz
linux-stable-88f8a01c42535285bcf2666d1f7eb9ada0de88cc.tar.bz2
linux-stable-88f8a01c42535285bcf2666d1f7eb9ada0de88cc.zip
Revert "rtnetlink: Reject negative ifindexes in RTM_NEWLINK"
This reverts commit 42c8406432e730cb7442d97ecfdbf47084a5af4d which is commit 30188bd7838c16a98a520db1fe9df01ffc6ed368 upstream. It was improperly backported to 4.19.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>
Diffstat (limited to 'net/core')
-rw-r--r--net/core/rtnetlink.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index 794db633f1c9..79f62517e24a 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -2702,10 +2702,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;