From patchwork Tue Apr 19 12:51:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florent Fourcot X-Patchwork-Id: 12818186 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 454CFC433F5 for ; Tue, 19 Apr 2022 12:52:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348640AbiDSMzG (ORCPT ); Tue, 19 Apr 2022 08:55:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49078 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234667AbiDSMzE (ORCPT ); Tue, 19 Apr 2022 08:55:04 -0400 Received: from olfflo.fourcot.fr (fourcot.fr [217.70.191.14]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 80EC43701B for ; Tue, 19 Apr 2022 05:52:21 -0700 (PDT) From: Florent Fourcot To: netdev@vger.kernel.org Cc: Stephen Hemminger , Brian Baboch , Florent Fourcot Subject: [PATCH net-next] Revert "rtnetlink: return EINVAL when request cannot succeed" Date: Tue, 19 Apr 2022 14:51:51 +0200 Message-Id: <20220419125151.15589-1-florent.fourcot@wifirst.fr> X-Mailer: git-send-email 2.20.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org This reverts commit b6177d3240a4 ip-link command is testing kernel capability by sending a RTM_NEWLINK request, without any argument. It accepts everything in reply, except EOPNOTSUPP and EINVAL (functions iplink_have_newlink / accept_msg) So we must keep compatiblity here, invalid empty message should not return EINVAL Signed-off-by: Florent Fourcot Tested-by: Guillaume Nault Reviewed-by: Eric Dumazet --- net/core/rtnetlink.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c index b943336908a7..73f2cbc440c9 100644 --- a/net/core/rtnetlink.c +++ b/net/core/rtnetlink.c @@ -3457,7 +3457,7 @@ static int __rtnl_newlink(struct sk_buff *skb, struct nlmsghdr *nlh, return rtnl_group_changelink(skb, net, nla_get_u32(tb[IFLA_GROUP]), ifm, extack, tb); - return -EINVAL; + return -ENODEV; } if (tb[IFLA_MAP] || tb[IFLA_PROTINFO])