From mboxrd@z Thu Jan 1 00:00:00 1970 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 0906DFA373E for ; Mon, 24 Oct 2022 11:33:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229556AbiJXLdW (ORCPT ); Mon, 24 Oct 2022 07:33:22 -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 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org 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;