Received: by 2002:a05:6359:6284:b0:131:369:b2a3 with SMTP id se4csp3449867rwb; Mon, 7 Aug 2023 13:52:10 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF0EOxampER5HTys265QYfupHxFD5zzXAgqXw3lLmvdlPoVRp4UdZo8Cw6UNb2BlA4bnkFC X-Received: by 2002:a17:902:db0e:b0:1bc:5e85:9871 with SMTP id m14-20020a170902db0e00b001bc5e859871mr8075257plx.54.1691441530289; Mon, 07 Aug 2023 13:52:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691441530; cv=none; d=google.com; s=arc-20160816; b=cKKfH1y6mWxqGDWeXBl3E05o0njSzCfUJarLaCv0B/k30gosAKbtUi1H3VR4hfUOnO PAvEiFAm06KxHmnmrNykWvLAKo4akJaAWUm2fj7PS2Uzc97Kjzip+fHyXJRshYdsRP67 WaoIfG5XsXqsNJDPz3qZdn0VOLKeZCXg0vT3hIw01yfdl/FQlDjgpkVVMCCbOmNE12cE 7HZRSdDABJs8TJ4OAWK9dCy9BEZdTgbyLm/KAW6q8+fHvef5b9R/8VL5JoiJ+I/uQr8/ KdclE7lKpA2y/PNvN91WFU0bFE2SqgvbjWoDYG48jvcAFbs7JM5c6LqsBHE1/3V5hUxS JCuw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=OjaD1kiL3NKu3sqnMgGz4vBVLZs1JplbyeNEYGhZYI8=; fh=8TGwgYewnKg72C2mqheR5QcbCBznBHDFeY0QRKvTKPg=; b=jFW5lY86R6pkstNJH7JCgr63VczuZ6lCJ9NzRMMDrUWSGPIDh1zSQwd4Bqye6ywVlq QI8l9pTK50JjXt11HdrgX06vwzRbNwn/o1MIhJNFqHcwFluJIh1eldtB1Iqw/vTu2tdt 19wbuRiKj4Zfx8IMhBgaxOiqLKNdaaW3pu6MhF4uKgpu2I4BcqyyAVCjstZWiLFyCkMI BrVzswlAs+PNhOrtmrmkAXt7GjtvAEO7mDty/lZ8URU8qVsyMBbdUssaUJ4VRgwPoQOT LFkROAwej7QldRsBfpCGJ/B0T/hRdvFbUoyoRB+ACUjTnJ+jFAYQsPAyEoFJtgvdwmJ7 8NhQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amazon.com header.s=amazon201209 header.b=Z2vb0LJ5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id kw7-20020a170902f90700b001b8ba81d04dsi3116037plb.395.2023.08.07.13.51.57; Mon, 07 Aug 2023 13:52:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amazon.com header.s=amazon201209 header.b=Z2vb0LJ5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230078AbjHGUSE (ORCPT + 99 others); Mon, 7 Aug 2023 16:18:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55924 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231382AbjHGUSB (ORCPT ); Mon, 7 Aug 2023 16:18:01 -0400 Received: from smtp-fw-9103.amazon.com (smtp-fw-9103.amazon.com [207.171.188.200]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5FE7F10E9; Mon, 7 Aug 2023 13:18:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1691439480; x=1722975480; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=OjaD1kiL3NKu3sqnMgGz4vBVLZs1JplbyeNEYGhZYI8=; b=Z2vb0LJ596ZAnbGP67PRzpe7SM22pChumwTNCejhb8A8T2RWGKWEW0q5 B46Gf/l5ig+E+sfv5952UYhX5EBnXZXI9u7hqTlvlEdRRJK8tQ5PE6FWY /AeyqdwL9y5FHjHUBwsp1XSGxpPmE0cSYwA543P+6Jfz2tDh7EDxbGcJm E=; X-IronPort-AV: E=Sophos;i="6.01,262,1684800000"; d="scan'208";a="1147272346" Received: from pdx4-co-svc-p1-lb2-vlan3.amazon.com (HELO email-inbound-relay-pdx-2b-m6i4x-a893d89c.us-west-2.amazon.com) ([10.25.36.214]) by smtp-border-fw-9103.sea19.amazon.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Aug 2023 20:17:54 +0000 Received: from EX19MTAUWB001.ant.amazon.com (pdx1-ws-svc-p6-lb9-vlan3.pdx.amazon.com [10.236.137.198]) by email-inbound-relay-pdx-2b-m6i4x-a893d89c.us-west-2.amazon.com (Postfix) with ESMTPS id D6A6540D59; Mon, 7 Aug 2023 20:17:53 +0000 (UTC) Received: from EX19D004ANA001.ant.amazon.com (10.37.240.138) by EX19MTAUWB001.ant.amazon.com (10.250.64.248) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.30; Mon, 7 Aug 2023 20:17:46 +0000 Received: from 88665a182662.ant.amazon.com.com (10.187.170.12) by EX19D004ANA001.ant.amazon.com (10.37.240.138) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.30; Mon, 7 Aug 2023 20:17:43 +0000 From: Kuniyuki Iwashima To: CC: , , , , , , , , , Subject: Re: [PATCH linux-next v2] net/ipv4: return the real errno instead of -EINVAL Date: Mon, 7 Aug 2023 13:17:33 -0700 Message-ID: <20230807201733.45450-1-kuniyu@amazon.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230807015408.248237-1-xu.xin16@zte.com.cn> References: <20230807015408.248237-1-xu.xin16@zte.com.cn> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.187.170.12] X-ClientProxiedBy: EX19D040UWA002.ant.amazon.com (10.13.139.113) To EX19D004ANA001.ant.amazon.com (10.37.240.138) X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,T_SPF_PERMERROR autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: xu.xin.sc@gmail.com Date: Mon, 7 Aug 2023 01:54:08 +0000 > From: xu xin > > For now, No matter what error pointer ip_neigh_for_gw() returns, > ip_finish_output2() always return -EINVAL, which may mislead the upper > users. > > For exemple, an application uses sendto to send an UDP packet, but when the > neighbor table overflows, sendto() will get a value of -EINVAL, and it will > cause users to waste a lot of time checking parameters for errors. > > Return the real errno instead of -EINVAL. > > Signed-off-by: xu xin > Reviewed-by: Yang Yang Recently I was also investigating a similar issue that ip_finish_output2() returned the fixed -EINVAL. But in my case, arp_constructor() failed with -EINVAL, and ___neigh_create() returned ERR_PTR(-EINVAL); So, there are still confusing paths even with this patch though, the change would be useful. Reviewed-by: Kuniyuki Iwashima Thanks! > Cc: Si Hao > --- > net/ipv4/ip_output.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c > index 6ba1a0fafbaa..f28c87533a46 100644 > --- a/net/ipv4/ip_output.c > +++ b/net/ipv4/ip_output.c > @@ -236,7 +236,7 @@ static int ip_finish_output2(struct net *net, struct sock *sk, struct sk_buff *s > net_dbg_ratelimited("%s: No header cache and no neighbour!\n", > __func__); > kfree_skb_reason(skb, SKB_DROP_REASON_NEIGH_CREATEFAIL); > - return -EINVAL; > + return PTR_ERR(neigh); > } > > static int ip_finish_output_gso(struct net *net, struct sock *sk, > -- > 2.15.2