Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2748431pxj; Mon, 31 May 2021 09:44:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyLIX79hf5UHZBNMhqTHzi8lqNeKX7BX7AfZit6BIwRymO2ztsISCFB+AN48zeRv6cg3Nnm X-Received: by 2002:a05:6638:12c5:: with SMTP id v5mr21314026jas.11.1622479493334; Mon, 31 May 2021 09:44:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622479493; cv=none; d=google.com; s=arc-20160816; b=oHOUITki/l8FaWlRwN8KjNZoIDT9XC1/wclKbjFjrjvsI5kGf/EhHIGv2VyCCvkDsr MyFurtt2/3BpSAsVd3ZJq0EI4Rgj0M4S/AOEkURX1WDMv42BCM2vRSbdI2HQBhTXHRwY jBYZZREwr5qgYp+LSqtm5jf2KL2RwKyXQMGxigPNRnTPXT7OcJWJW95T+hKwKo3enGQW uvYDeqMNfCbsPqvOJCt9xa6z0GvwsjlfskaUXFQx8wzgvJP5DDwLVLkdan5Hfo2U4ulr N306+GPwSHUEKF/0hEFcL4c7j8yLCw2FaigxkH4gTcrqs7sGHWaWoVkX4sZ52KEjvEKr +QUg== 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=BrfNlVfEr5syus/iRRfzUFpmIckCsjCt4UyK65wcW+o=; b=jY6IYd4NqF9YMRw1Qxb5CwR+BdMrxliMXD5J5sRH82BrbN//RUriULrDvpMkU4ckpl TAKwHVqgLFKTwbRrZx4832aoWhaMTW4w1nKNzf5GQl7De2AZchkoMxJkK8GYa/ot0Jgz 7DIoh8si1membXuoCTPm2HG6iv/5d6Cp+0WZ486ViF6mmbXqTlKftJHSWiGSM2UWrwv2 BRJAyS1SR5Dg8M1Jksr9b6BYp89OyesKB51sTvJ7H2dbNfkZopxD86obR/zNCZOduGjm ICtO2hiX0ho4xdq99Dz8x6qkEXyFROMU2JlyACyVOh9dUU5jAIBvb4wCX7YIqyXUe9WD 9t3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=pOETWC48; 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 h6si19099974iow.71.2021.05.31.09.44.40; Mon, 31 May 2021 09:44:53 -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=pOETWC48; 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 S231204AbhEaQoy (ORCPT + 99 others); Mon, 31 May 2021 12:44:54 -0400 Received: from mail.kernel.org ([198.145.29.99]:46632 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232626AbhEaOyC (ORCPT ); Mon, 31 May 2021 10:54:02 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 0F4DD61CAC; Mon, 31 May 2021 13:59:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1622469555; bh=kEqZaRDMA6nbc5KtPc99Zqt3YTBcosbI8H0fk5s158A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pOETWC48/LX2zlr2AI88OPcyood/tdLfr504mzM7YVx1TXQnwIjY1wbqO5bqJ4g/V HHHrX0kEHMoP4xKnV19ckIyeb4znqPaFBRWq5qlHcThZ/bCdLRmnpOpO2znrMX9aqG 4PyI2z2M9kwN9mCZgSC+zHOjssuvhw5z/vJy8Jnc= 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.12 241/296] tls splice: check SPLICE_F_NONBLOCK instead of MSG_DONTWAIT Date: Mon, 31 May 2021 15:14:56 +0200 Message-Id: <20210531130711.896742931@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210531130703.762129381@linuxfoundation.org> References: <20210531130703.762129381@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 01d933ae5f16..6086cf4f10a7 100644 --- a/net/tls/tls_sw.c +++ b/net/tls/tls_sw.c @@ -37,6 +37,7 @@ #include #include +#include #include #include @@ -1281,7 +1282,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); @@ -1306,7 +1307,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; } @@ -1786,7 +1787,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, @@ -1990,9 +1991,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