Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp3894690pxm; Tue, 1 Mar 2022 07:25:20 -0800 (PST) X-Google-Smtp-Source: ABdhPJy+bcedZbJa9ycbNeNzQMEYV0kHIyWBPo1DskavPuSltQo4k9NduXyI3rXdBHLe8rOTuH2p X-Received: by 2002:a05:6402:270a:b0:410:a3a4:ba06 with SMTP id y10-20020a056402270a00b00410a3a4ba06mr24605332edd.293.1646148319942; Tue, 01 Mar 2022 07:25:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646148319; cv=none; d=google.com; s=arc-20160816; b=k4WG48p1SiPQ5SAQATGbt0ryfywcsGLkNfXLH0QxxguQEyaohf7ONZnLI5pc+wqHoj WG3ISeVH52una10+IzlR1B1ZTjDyUbPS7pNEWLb5v4gXi8Orzx7DLxCbIpVAFv/zpNSp k6kpgblR3XrYlBVIVWkhPUg63DXQuHZN8SCOLnOFzvEGT4echiIG+m4ewdt9i0XSNTFg jDuDpC0f5b/3K6BZ+F/wzJzv2D+uzKO1/sl3Xdt5AQvcgzQbT0INHfYzqYgLwBKEqTvx uifA4a9CVUWLvy9uKL+iMvlAjpzUafoRwSeayLafjTRHacdIQXHjJQbydldHQ36pPjD/ ubeA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:organization:content-disposition :mime-version:mail-followup-to:message-id:subject:cc:to:from:date; bh=uLMcOzVG/3VkeONRRPUU8yX2WTe3SRCGERRJxJUa2mE=; b=QcJhay+15oJPNaRTmkUnEOPaR4migIRnDHGYRg172nhYuKyliPsNzoHMHJi/Of3BZi hT4SkvSr1Gr1GYTUHlXwXoyAPL21eo97zAmH+55lgHLWcC0kkjnZ/00nC/5pvX1rKdcC kkD1jhL5WWRbkHHSAe/nnrT3B4+WN42SFlyvr+BQohFT8uq/vZFoAT0n9zPfghR8pq/q J2Hzy17UtahXvNlzFgqmIxC4ZGoqFB+6wXSMMKle8uUuD+2/FfmL6NIB3vnpsdWvB/as VQh4G1tt1zl8qGE4UGY/fVpS1RtkP/sQwcn7fovKuViwQSVC7kIjaanyL7kS/X9pUH4i rArA== 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:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q19-20020a056402519300b00410ed6741d9si9293665edd.465.2022.03.01.07.24.56; Tue, 01 Mar 2022 07:25:19 -0800 (PST) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=labri.fr Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231776AbiCAOyL (ORCPT + 99 others); Tue, 1 Mar 2022 09:54:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47150 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231182AbiCAOyI (ORCPT ); Tue, 1 Mar 2022 09:54:08 -0500 X-Greylist: delayed 508 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Tue, 01 Mar 2022 06:53:25 PST Received: from v-zimmta03.u-bordeaux.fr (v-zimmta03.u-bordeaux.fr [147.210.215.83]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BB9F24EA35 for ; Tue, 1 Mar 2022 06:53:24 -0800 (PST) Received: from v-zimmta03.u-bordeaux.fr (localhost [127.0.0.1]) by v-zimmta03.u-bordeaux.fr (Postfix) with ESMTP id 140081800A87; Tue, 1 Mar 2022 15:44:54 +0100 (CET) Received: from begin (nat-inria-interne-54-gw-02-bso.bordeaux.inria.fr [194.199.1.54]) by v-zimmta03.u-bordeaux.fr (Postfix) with ESMTPSA id D81FB1800A80; Tue, 1 Mar 2022 15:44:53 +0100 (CET) Received: from samy by begin with local (Exim 4.95) (envelope-from ) id 1nP3kD-00Bpvn-NJ; Tue, 01 Mar 2022 15:44:53 +0100 Date: Tue, 1 Mar 2022 15:44:53 +0100 From: Samuel Thibault To: willemb@google.com Cc: davem@davemloft.net, kuba@kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] SO_ZEROCOPY should rather return -ENOPROTOOPT Message-ID: <20220301144453.snstwdjy3kmpi4zf@begin> Mail-Followup-To: Samuel Thibault , willemb@google.com, davem@davemloft.net, kuba@kernel.org, linux-kernel@vger.kernel.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Organization: I am not organized User-Agent: NeoMutt/20170609 (1.8.3) X-AV-Checked: ClamAV using ClamSMTP X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham 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 is not exposed in , so applications cannot safely check against it. We should rather return the well-known -ENOPROTOOPT. Signed-off-by: Samuel Thibault diff --git a/net/core/sock.c b/net/core/sock.c index 4ff806d71921..6e5b84194d56 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 = -ENOPROTOOPT; } else if (sk->sk_family != PF_RDS) { - ret = -ENOTSUPP; + ret = -ENOPROTOOPT; } if (!ret) { if (val < 0 || val > 1)