Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2675676pxj; Mon, 31 May 2021 08:01:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwuPiPiCTk6WzzlPBIt9IuVKsJ2lMO/Pp/5x12ryijnmKFJO7KNIhfPZyT4dbOSnq6kW8WC X-Received: by 2002:a5d:9694:: with SMTP id m20mr12768375ion.185.1622473299717; Mon, 31 May 2021 08:01:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622473299; cv=none; d=google.com; s=arc-20160816; b=QdwqvIcSm+V0vPIdND5OlizPLewXpsSlaA6uLPMkTemTRarhbbmVJmE392R8Iv3Nix IgQvmQ+s2gm0K0rMxLoJst14oxzgMkplcuKNE2ZImVsN6Wsel1soBTlvAiRuW2XcW3wX BZnJ/BZ8Jrwm+DrJzs+d/qeePJZXSiVmLiYigvSAOfg62bBmMOJ3mYQHX4qlW+MNwAzR /J1ByfgcOzXMz4HqogClMw7whUor9u4ME63OP1lP8lbMJXvuWSPTgfgWk0g6WXcvzJ2P LM25RSS3CR524BS1fOij9QhiP8JUC0EFIXUnVF36F3g3Ez7tLnVZOrLv/6wTJpVLPpPx rJ6A== 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=PUFTGBG30VXrq3g8Vyi/MnZ8VRYfces8yNJSegCWUrQ=; b=oB0eXJXiLOkn5Cp8YasVruZi/POGnUxdnUH5eV0JsQc+bVecL8dUcQS2ptEhZ0YUCj ZtXLjDQ0O/NYVfnzTV5OOvRoouiDO7/WPHA45olPNTMw3u7kDEOnH2OAmcsMIdDRHaDU EDV6Z0Mz70W1+RsijjASzM2uaWWB6Fr/g+94QFDLjqVAV5wu7YNh0/ZE6lujqu65UEe0 RkC867HWitk7L1wz4khEk/WcjqgBMLJbaRP/ZEPc8ZKShyP2w2twhnH9AsCs1vrDVEGY BeHc8dFAN34MAAut+IC+tRlEenMXBRay/b68l4lscBHpWcOGFH7J6p6sM6nQ6UJfz/Iw aXnw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=DZ+qMPeu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q3si16410238jac.31.2021.05.31.08.01.26; Mon, 31 May 2021 08:01:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=DZ+qMPeu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S232513AbhEaPCb (ORCPT + 99 others); Mon, 31 May 2021 11:02:31 -0400 Received: from mail.kernel.org ([198.145.29.99]:37786 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233157AbhEaOGd (ORCPT ); Mon, 31 May 2021 10:06:33 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id E26BB61458; Mon, 31 May 2021 13:38:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1622468337; bh=dPH8jfCynb71gmIZShaBaJy5/X+Me3+uHCk3gGdP82U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DZ+qMPeu2dzWK3lWhE+cftPvVt/tyw98qjcKjCWF/faawR/FxNaTwRTJIa78835BC Hav9MexMnspr1V4a7BcHeLulbvo1Xk6eh5XncEWu7HEQr8ABmVgus0fa4SVRmTWZLH N/9tUWvMcideypjRvtN/q4dSCHT8SmKc1dnNYhW4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jim Ma , "David S. Miller" , Sasha Levin Subject: [PATCH 5.10 206/252] tls splice: check SPLICE_F_NONBLOCK instead of MSG_DONTWAIT Date: Mon, 31 May 2021 15:14:31 +0200 Message-Id: <20210531130705.013320213@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210531130657.971257589@linuxfoundation.org> References: <20210531130657.971257589@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jim Ma [ Upstream commit 974271e5ed45cfe4daddbeb16224a2156918530e ] In tls_sw_splice_read, checkout MSG_* is inappropriate, should use SPLICE_*, update tls_wait_data to accept nonblock arguments instead of flags for recvmsg and splice. Fixes: c46234ebb4d1 ("tls: RX path for ktls") Signed-off-by: Jim Ma Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- net/tls/tls_sw.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/net/tls/tls_sw.c b/net/tls/tls_sw.c index 845c628ac1b2..3abe5257f757 100644 --- a/net/tls/tls_sw.c +++ b/net/tls/tls_sw.c @@ -37,6 +37,7 @@ #include #include +#include #include #include @@ -1282,7 +1283,7 @@ int tls_sw_sendpage(struct sock *sk, struct page *page, } static struct sk_buff *tls_wait_data(struct sock *sk, struct sk_psock *psock, - int flags, long timeo, int *err) + bool nonblock, long timeo, int *err) { struct tls_context *tls_ctx = tls_get_ctx(sk); struct tls_sw_context_rx *ctx = tls_sw_ctx_rx(tls_ctx); @@ -1307,7 +1308,7 @@ static struct sk_buff *tls_wait_data(struct sock *sk, struct sk_psock *psock, if (sock_flag(sk, SOCK_DONE)) return NULL; - if ((flags & MSG_DONTWAIT) || !timeo) { + if (nonblock || !timeo) { *err = -EAGAIN; return NULL; } @@ -1787,7 +1788,7 @@ int tls_sw_recvmsg(struct sock *sk, bool async_capable; bool async = false; - skb = tls_wait_data(sk, psock, flags, timeo, &err); + skb = tls_wait_data(sk, psock, flags & MSG_DONTWAIT, timeo, &err); if (!skb) { if (psock) { int ret = __tcp_bpf_recvmsg(sk, psock, @@ -1991,9 +1992,9 @@ ssize_t tls_sw_splice_read(struct socket *sock, loff_t *ppos, lock_sock(sk); - timeo = sock_rcvtimeo(sk, flags & MSG_DONTWAIT); + timeo = sock_rcvtimeo(sk, flags & SPLICE_F_NONBLOCK); - skb = tls_wait_data(sk, NULL, flags, timeo, &err); + skb = tls_wait_data(sk, NULL, flags & SPLICE_F_NONBLOCK, timeo, &err); if (!skb) goto splice_read_end; -- 2.30.2