From patchwork Mon Oct 24 11:31:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8369 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp392639wru; Mon, 24 Oct 2022 04:35:49 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4UJiv88pAhfES5/MU/KbvrnlabWPbkcIGBsE/OEDPRT3mh+3cdfHt+u1hjJ1RieA8jL7I5 X-Received: by 2002:a63:1861:0:b0:462:4961:9a8f with SMTP id 33-20020a631861000000b0046249619a8fmr28219438pgy.372.1666611348812; Mon, 24 Oct 2022 04:35:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666611348; cv=none; d=google.com; s=arc-20160816; b=UOIpFpgTVJ9hpm2+log5QRg9fJSdFhUFH/+M9HPjXx8jW0G3SzZvLgISrR1vDbVv0j CtrYZlw/BgvJneM5EMhTwlGQ/Qpd/DMMngu6wjsGx6wDNWKhO+AAfxH/hJ2TCQm8+9iU 5EjW7UrW0ZfSlsWj0jgJqJyD7Tr3xLwZOAT85splzxv3eT6x11Ht/Mwj0s+njYLkAdKB DIDUXZtzduPfhjabhfnEeXRxC6K2IOVVNb0zneMPBS9aMxgju2zR6Si/6lge2oKTtYf5 ukyE/hnFm2fyzE+Lm/j66syfgTMMl/4B42zxyAQS4EnnwCry1mj/t9qEzXsd3uRx3763 QRdg== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=maX5YDzb2TU5F7jNzZEuECzFn0KDrCvEWjVDLfbsWVE=; b=x/IML8z5viapDjK1zAs6kKFz4fCVrRAsfzZxOBA2rzpeN0zNAXk+KMhb3DvPQObbjY tsl3WiwFKXWJ2a0zaYJcgMioForvb4akxWdgvysSR2h6D+PZxqSOldDXqvifvIJBLqMT EC6EcAo0NJk10zcvAeS5KXrXJ++iQ6QLyNqV0uIdHwmZ/i89vKj3l7urKwFpK0GQ/C1O zvsQl8NMJykg6IEvy0+wTu8pKG/AFaaO47z4MKIHY90CdQQhLabMRmFQy+XAGdlyZupu 2rSr7MJn9gmJNoEdjbnHF8JBrhgWuO+AuPqJ5JOSe6Qi6n8mX9GTrHNKxxldXNN8DNlJ iHUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Xu4Yt9bh; 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=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h71-20020a63834a000000b0046efd063864si3507780pge.109.2022.10.24.04.35.35; Mon, 24 Oct 2022 04:35:48 -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=@linuxfoundation.org header.s=korg header.b=Xu4Yt9bh; 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=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229542AbiJXLdY (ORCPT + 99 others); Mon, 24 Oct 2022 07:33:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58028 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229904AbiJXLci (ORCPT ); Mon, 24 Oct 2022 07:32:38 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 51F866173F; Mon, 24 Oct 2022 04:32:22 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5B2FE6125A; Mon, 24 Oct 2022 11:32:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6C1EFC433C1; Mon, 24 Oct 2022 11:32:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666611139; bh=ls/FY9lIc8Kn+4qnUhrnD5jdUO7ASdakq191rkjNnn4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Xu4Yt9bh+wGUtgjjFC+/H9HxJuAVvvixqq7HBKJW5TjjMzRVjgyOPRNQ/XHmFcVgh B1Ri1K3OWKnZTD4SsFSnlBeSYUGqymDsa+m+g597aXe1k69XlJVt/XzmdC0E3DfYiY JzlfsJ9OjD7KSurg7cP/piqqL+2LyYUDABkYAyro= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pavel Begunkov , Jens Axboe Subject: [PATCH 6.0 05/20] io_uring/net: fail zc send when unsupported by socket Date: Mon, 24 Oct 2022 13:31:07 +0200 Message-Id: <20221024112934.634360980@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112934.415391158@linuxfoundation.org> References: <20221024112934.415391158@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747568661623201530?= X-GMAIL-MSGID: =?utf-8?q?1747568661623201530?= From: Pavel Begunkov commit edf81438799ccead7122948446d7e44b083e788d upstream. If a protocol doesn't support zerocopy it will silently fall back to copying. This type of behaviour has always been a source of troubles so it's better to fail such requests instead. Cc: # 6.0 Signed-off-by: Pavel Begunkov Link: https://lore.kernel.org/r/2db3c7f16bb6efab4b04569cd16e6242b40c5cb3.1666346426.git.asml.silence@gmail.com Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman --- io_uring/net.c | 2 ++ 1 file changed, 2 insertions(+) --- a/io_uring/net.c +++ b/io_uring/net.c @@ -1001,6 +1001,8 @@ int io_send_zc(struct io_kiocb *req, uns sock = sock_from_file(req->file); if (unlikely(!sock)) return -ENOTSOCK; + if (!test_bit(SOCK_SUPPORT_ZC, &sock->flags)) + return -EOPNOTSUPP; msg.msg_name = NULL; msg.msg_control = NULL;