Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2654057pxa; Mon, 17 Aug 2020 15:37:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxhm22twoFpXyKjH+pwaFHzpv6P0BxYUd2R7pB8W8ickpz5VD4DlY/fVKzREf1zVK6Pj9/7 X-Received: by 2002:a50:fd0b:: with SMTP id i11mr16623783eds.298.1597703825254; Mon, 17 Aug 2020 15:37:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597703825; cv=none; d=google.com; s=arc-20160816; b=SXCQriio+ocQWt4BZqaZJY2AvIMelY0pacrsaHdNTuAldQiucUNjEHTJctACwNMI5y 0t9N8zBTdFUgxfqRB71oi3T3cIYPNAEE4V3H3efSG1r+ehRZbalC7LGiBme+MmCLeTZ1 Bqbz9reeNNOxYxC/PwViChIIJhlwvws5UJngbkFvq/wdGWyzLXOHIlcd3qW6TA4VT5tT RTjlWaATrIAMNIVNkLSH3DwQrVNgCNBhqGXUTC99rv02DC5WaBcwZ5DKISCYJIMD22P1 EWDxuzj+a/+RWjxbUJJ4qCb4fLGkry1IQPMfcpvWm1C3LeVCRIbEPdFkAaMR5b3NUT8k DuuQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=kRKloAFFd8ZqWtQyllK0aokzU1AuCh9daE9JBIe7mxE=; b=Ek1ERshyU6W5hfmep2QvRbNc6+Q4I/SsNJNcpnRhanC0x9JwBKDVI6K3jUfoSG/PGh pbSGyZrwCRJiRD6C39HTVY9aC/wmkRlBXPqUgOCCDG3J0om8yrnVLvwPL/9XyQEBu8oi IZBioQfA48B6z/W71WLPk90Htlw+wYGcIeTVU8vvviMv8ezftJCJ1nWGu2xvYombld2C ZOqMCohZVJK+dyhCJ74yeYuc5dweUtinPd97O05Nqmcndpkik/Y1T55uZjU3xN5vG2MB j9L1xuzUyTgAHcxvDYLdVxqilC56vb/F/aKYCpwpmCarEgLEZNf9RL2iPXqk18970B+B Dg3A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=hjYnskCg; 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=fail (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 gy22si11516293ejb.137.2020.08.17.15.36.41; Mon, 17 Aug 2020 15:37:05 -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=@kernel.org header.s=default header.b=hjYnskCg; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730013AbgHQRfY (ORCPT + 99 others); Mon, 17 Aug 2020 13:35:24 -0400 Received: from mail.kernel.org ([198.145.29.99]:33266 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730054AbgHQQRp (ORCPT ); Mon, 17 Aug 2020 12:17:45 -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 7483C2075B; Mon, 17 Aug 2020 16:17:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597681060; bh=JwBFHVM3zClCcFsLQOBYkaN/QxPl8gqzR3imMdH576I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hjYnskCgbbSFLWvINDUAGhwzSibQKjhjCWrwhy6mCTo01TT0udAVje8zZhhkf5WaW m+q5X1GOoyQv/Fs7V1+rijPhvtIr/OyeDmsaWOJU8eHxEXGmj0Cxdmbq2TNtMTk7xO Kyih1e9alVjnZ71ZtuZQIhI3hA67RFh4jCV/0MTY= 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 4.19 135/168] net/tls: Fix kmap usage Date: Mon, 17 Aug 2020 17:17:46 +0200 Message-Id: <20200817143740.446300902@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200817143733.692105228@linuxfoundation.org> References: <20200817143733.692105228@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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 @@ -476,7 +476,7 @@ int tls_device_sendpage(struct sock *sk, int offset, size_t size, int flags) { struct iov_iter msg_iter; - char *kaddr = kmap(page); + char *kaddr; struct kvec iov; int rc; @@ -490,6 +490,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 | ITER_KVEC, &iov, 1, size);