Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp3530841pxp; Tue, 8 Mar 2022 16:45:39 -0800 (PST) X-Google-Smtp-Source: ABdhPJxEM1MCe7515ut9mkGY0Z3SU7FOEH3RdSTITnGBj0mxjatIpyGcCHUUeztfD+btBoD3iOUu X-Received: by 2002:a65:63cc:0:b0:378:d782:bc0e with SMTP id n12-20020a6563cc000000b00378d782bc0emr16341803pgv.220.1646786739444; Tue, 08 Mar 2022 16:45:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646786739; cv=none; d=google.com; s=arc-20160816; b=E1+XZvGq8tI2/N0MINaQaGS8ROngCm5IS9Q3VSR+X7WNbNgWuaWXjs9dazeHu2+utQ FOaq62uoS7IOubWfjsRG8EGI0vaxLs1++ubH9jU3SZWpdEGho36SlNF6UjiEht8luO5N gB3b5LKLPaG4THIiWBsJDB4IRAVoVKzVhXXcnEHF+z2PMh3/kol1gfoanb1IPKv5WzjY zkjcMSNnpyig6K/ldxETFMiLq0N749rhc11KCn1xGmKrP2cjzbf9zb4K3swJdpOXFZST CzhlZN3DEMIW56QUgx0+1ql7V93gqVbiDYh6cr7Kt9U8eJ1NAB6nlh2Gi/RD9g0GiRuX 4XTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:content-disposition:mime-version :mail-followup-to:message-id:subject:cc:to:from:date; bh=cNPBhWPA2LkgkAMviL2aV0ANFsl3ExCGb7Z0hIbXGXs=; b=A5t+7SRKStyUd4qaR3OlAugujt0rDXEbFW0exLOsYEUHoTGp36z8RAIuHxjYAbalIQ 6X8kBLWlL77lBagpF7TUc3tbn6430w/jNMM2iDNCjb2N2BGM7vIYcJZF4pb2Ul/EADGe wMxL+NZ6NP6ZurDBY9vzML2OKVrxBTxCjnh6Zi+AaFNh63L24DstxPPdLZ4I9PFDvXSh 2RkLlfvml1Yhr9tlGhHV1zawdZEriCSnc8bZ2vcI4n+aepapv3OcIV9DSO3BPfOM7w04 i/ukhQZXpLbYenzBo3HT6JSEvA9QNSgPyzjeU/MFwQ8YPFuzqb7luVB7qOxEZ40byiRB h5HA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=labri.fr Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id np9-20020a17090b4c4900b001bf738669b6si4000441pjb.53.2022.03.08.16.45.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Mar 2022 16:45:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=labri.fr Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id CE5D0DA87E; Tue, 8 Mar 2022 16:02:02 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242541AbiCGWc1 (ORCPT + 99 others); Mon, 7 Mar 2022 17:32:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39650 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236396AbiCGWcZ (ORCPT ); Mon, 7 Mar 2022 17:32:25 -0500 Received: from v-zimmta03.u-bordeaux.fr (v-zimmta03.u-bordeaux.fr [147.210.215.83]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CF7A22DD68; Mon, 7 Mar 2022 14:31:28 -0800 (PST) Received: from v-zimmta03.u-bordeaux.fr (localhost [127.0.0.1]) by v-zimmta03.u-bordeaux.fr (Postfix) with ESMTP id EBCB818014AC; Mon, 7 Mar 2022 23:31:26 +0100 (CET) Received: from begin.home (lfbn-bor-1-255-114.w90-50.abo.wanadoo.fr [90.50.98.114]) by v-zimmta03.u-bordeaux.fr (Postfix) with ESMTPSA id B0F3918014A5; Mon, 7 Mar 2022 23:31:26 +0100 (CET) Received: from samy by begin.home with local (Exim 4.95) (envelope-from ) id 1nRLt0-00C9Ci-8c; Mon, 07 Mar 2022 23:31:26 +0100 Date: Mon, 7 Mar 2022 23:31:26 +0100 From: Samuel Thibault To: davem@davemloft.net, kuba@kernel.org Cc: Willem de Bruijn , linux-kernel@vger.kernel.org, Network Development Subject: [PATCHv2] SO_ZEROCOPY should return -EOPNOTSUPP rather than -ENOTSUPP Message-ID: <20220307223126.djzvg44v2o2jkjsx@begin> Mail-Followup-To: Samuel Thibault , davem@davemloft.net, kuba@kernel.org, Willem de Bruijn , linux-kernel@vger.kernel.org, Network Development MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: NeoMutt/20170609 (1.8.3) X-AV-Checked: ClamAV using ClamSMTP X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE 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 ENOTSUPP is documented as "should never be seen by user programs", and thus not exposed in , and thus applications cannot safely check against it (they get "Unknown error 524" as strerror). We should rather return the well-known -EOPNOTSUPP. This is similar to 2230a7ef5198 ("drop_monitor: Use correct error code") and 4a5cdc604b9c ("net/tls: Fix return values to avoid ENOTSUPP"), which did not seem to cause problems. Signed-off-by: Samuel Thibault --- Difference with v1: use -EOPNOTSUPP instead of -ENOPROTOOPT. diff --git a/net/core/sock.c b/net/core/sock.c index 4ff806d71921..839eb076afee 100644 --- a/net/core/sock.c +++ b/net/core/sock.c @@ -1377,9 +1377,9 @@ int sock_setsockopt(struct socket *sock, int level, int optname, if (!(sk_is_tcp(sk) || (sk->sk_type == SOCK_DGRAM && sk->sk_protocol == IPPROTO_UDP))) - ret = -ENOTSUPP; + ret = -EOPNOTSUPP; } else if (sk->sk_family != PF_RDS) { - ret = -ENOTSUPP; + ret = -EOPNOTSUPP; } if (!ret) { if (val < 0 || val > 1)