Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2710122pxj; Mon, 31 May 2021 08:48:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyomRkdYX9PbPSuoOJOrH5WaZKmDxiUbzVh3cK18tWw3avx9AZJDZmFJXAHRqjVzC7wPsOD X-Received: by 2002:a05:6e02:1b83:: with SMTP id h3mr16626356ili.199.1622476122740; Mon, 31 May 2021 08:48:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622476122; cv=none; d=google.com; s=arc-20160816; b=BTMzDl3DhSS8ThsuKrBAxNHFkmKhoFFnQOfLkFmbB6WE9SqkEYNMzZ4FSTciebsLkW XES9uMH97ZUUKs+xhBQaVIRZOLQSAzTT5cVJrgqNSGpmYs76xeiTt2xZJmAevmqdxrpP seem0q3bb3p1JsBYMDkz1ZMzIVP6RLBWcrwb8rLyxSNwgN+AnXO63IqqvhC5xhjS5kqN gtDDFJWYfXWsSNpqjPRvBw6LoGhFffSzA/q3twJv0/2IS/drHlWOKrre1aNNXFkYh4nq 3vdFFNa51fin9cj3OCuLaeLVGkMMQpSg2UxaS+CBTqWuyMmUilElanGtcG4igWHmUbW9 ogCA== 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=SkZ4dZ3pZc7YLRm1oF28EHHUqhWNo2SkL03EaFWywqo=; b=0wjhhGZUHqzfpDfNMpUFDvEBAoI2AzxT5yM7a1MUO1gdxnUlJpMGNd73FWhV0wlcsf kIzA8ytoD6Wv2IP99t6GQBD2NatA9eloXx9FSb+km73KWDbMvCs3YbD374OBW1dCA3gF +M2vg8yT4fMh+O2Uot4+aiAJTIqNddBTJoaEMXF57OGiswrC7bXQ3bAriD7v9gG7V1XB 4yN/NeS1H+hyd+iLkR9/fA5/SfDSS7OwG2Mb5cZvfozzEWxmKijuItLOOuWUpJ7yePpV bk4KiqE7XCAR9MqAuExhUv77ND7HwoxLGURPUmx8HUwEWXSLfRZnhzLdDTJEauplYIuV lvqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=VbThuDVI; 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 f2si16113504ioz.41.2021.05.31.08.48.29; Mon, 31 May 2021 08:48:42 -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=VbThuDVI; 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 S233135AbhEaPrx (ORCPT + 99 others); Mon, 31 May 2021 11:47:53 -0400 Received: from mail.kernel.org ([198.145.29.99]:55744 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233195AbhEaO1E (ORCPT ); Mon, 31 May 2021 10:27:04 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id B773A61A33; Mon, 31 May 2021 13:47:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1622468829; bh=hCXrfYHR/s9m/pN/ieWCvVdVEhpJY0hz/QoMEBN18pY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VbThuDVIjA+HmeoclPR2fAFWGPLYvByGD/VogFC5U35FcurSZjGHjmdLVCcQZRtsa F23F1UqslvgG++jJXqeUdrypGC2m3fgqOU3gr4DmUDYyp7LITGf9PhrCsWAy/r5aiK UyEiYyckjFJGJWnykXZwaSobhIvSS6AU40NWYJcI= 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.4 144/177] tls splice: check SPLICE_F_NONBLOCK instead of MSG_DONTWAIT Date: Mon, 31 May 2021 15:15:01 +0200 Message-Id: <20210531130652.912117996@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210531130647.887605866@linuxfoundation.org> References: <20210531130647.887605866@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 0d524ef0d8c8..cdb65aa54be7 100644 --- a/net/tls/tls_sw.c +++ b/net/tls/tls_sw.c @@ -37,6 +37,7 @@ #include #include +#include #include #include @@ -1278,7 +1279,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); @@ -1303,7 +1304,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; } @@ -1781,7 +1782,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, @@ -1985,9 +1986,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