From patchwork Mon Aug 17 15:16:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 266170 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AD44AC433DF for ; Mon, 17 Aug 2020 18:41:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8CD29204EC for ; Mon, 17 Aug 2020 18:41:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597689682; bh=JX9YD0fyNo6GydpHRaQDCiHNNZT4tpcruFeiYGycKgM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=uZeDFC3fX48dilQ77PpGWCO9+4LiqCiPwzm3n5N4qUTbUwfVLw8qlo6m/QgAWuT+b tFuwbbtWJhlOhlAEdJwt7VHZHcPhFaDE/C6YB2UJsMWbGZSzydI3uFLLjigSKZFDBc 9wWWPBuUDYzgLa1XxLEWzVLfmjQ10gGBdE82+U9A= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731548AbgHQSlV (ORCPT ); Mon, 17 Aug 2020 14:41:21 -0400 Received: from mail.kernel.org ([198.145.29.99]:44980 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730693AbgHQP5Z (ORCPT ); Mon, 17 Aug 2020 11:57:25 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 2B42F20760; Mon, 17 Aug 2020 15:57:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597679844; bh=JX9YD0fyNo6GydpHRaQDCiHNNZT4tpcruFeiYGycKgM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HvpuRhwPJM/Vca6ySJS1t5y3kHzr4lRk3uQFDqKNBPUKSyPTWzIO4Vuu1t/qGjYZu xO16IFj8x6kSTI0Ah+ofFAOrMxNRT+jLjV20fzcSW0j5HZCmxZ4/ftjPqoYUmZrhd6 3GyVwbDXss8MHsudnFLNHFE6q5qMBoHhu8fNqNnc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ira Weiny , Jakub Kicinski , "David S. Miller" Subject: [PATCH 5.7 323/393] net/tls: Fix kmap usage Date: Mon, 17 Aug 2020 17:16:13 +0200 Message-Id: <20200817143835.267242605@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200817143819.579311991@linuxfoundation.org> References: <20200817143819.579311991@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Ira Weiny [ Upstream commit b06c19d9f827f6743122795570bfc0c72db482b0 ] When MSG_OOB is specified to tls_device_sendpage() the mapped page is never unmapped. Hold off mapping the page until after the flags are checked and the page is actually needed. Fixes: e8f69799810c ("net/tls: Add generic NIC offload infrastructure") Signed-off-by: Ira Weiny Reviewed-by: Jakub Kicinski Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- net/tls/tls_device.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/net/tls/tls_device.c +++ b/net/tls/tls_device.c @@ -561,7 +561,7 @@ int tls_device_sendpage(struct sock *sk, { struct tls_context *tls_ctx = tls_get_ctx(sk); struct iov_iter msg_iter; - char *kaddr = kmap(page); + char *kaddr; struct kvec iov; int rc; @@ -576,6 +576,7 @@ int tls_device_sendpage(struct sock *sk, goto out; } + kaddr = kmap(page); iov.iov_base = kaddr + offset; iov.iov_len = size; iov_iter_kvec(&msg_iter, WRITE, &iov, 1, size);