Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3474997imu; Sun, 11 Nov 2018 15:57:55 -0800 (PST) X-Google-Smtp-Source: AJdET5eq4NDFDYACPt3jjvPMIPkna+3VVn32SIR8tPgIrvklkfoTo7EEJ+Row/O01r7lqLjbroGB X-Received: by 2002:a63:cc43:: with SMTP id q3mr15274513pgi.291.1541980675051; Sun, 11 Nov 2018 15:57:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541980675; cv=none; d=google.com; s=arc-20160816; b=u+1toG9MIxCxKg65R/PxdXMpZztk1vK+INZ8Md7hXz18LciEQlVEUp+bUmBGvfvIKP 7uuMpj1YzkAhIcGceP8MLmYEStGi+KHDzlF1McM9FhLs+gG7Or4O0Al/zIJy4lwUDHG3 EWocST+1SiqEHEXe1ELIdCMysgDIff4YIFOB5pYWNzlmpO15+WZzF3L+F6Q08jo38n/R JDu7b6xmG1AS3bFYsyfbxVmpUQiwpt3odJ1fsnAPQ6qddppBaBka+HcU8yiJ53tF7pNk ghLk7UauUEN7PMPTK86iDG9wgUIZKapd8Symzn/y5rS0kJJ9RKlWGI8DcqBZTRj19Oa6 85zQ== 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=muF+ZeMd/5K2wg2+YVc0BWCxO9CeWLomMOa1hhaIYh0=; b=ayT78818eNba2Zg879q2egas+VAE+b+vdAxpu8EpeFMjdjwVYpYWu1AZ0KTWjUQwEa zhmXjovaoUZVcdShaPhvn80Y0JwvYmlMgiNmATGfXe4nlJ7SRKMAfePSfeQRJe09LOfw f73v35irKnrz1ZK2eq9wCmu63E22K0NML39PkBDiO+SbTUIuyR09AFEjjjOOseMNDFHg Jtr0u6/W0fsntEI3arbnEdfvFO3GCDc6L52ufzOSCO//gBZZnylFpVyffzUK6anyJ1eK bPT+uzUxjmmPdihJPnLsZXl/QazxO9NSjWEx7+VALE7dQ14wZqJ+miKZS749D9udAm9B ocHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=E9prZFaj; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r24-v6si13025124pgv.380.2018.11.11.15.57.39; Sun, 11 Nov 2018 15:57:55 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=E9prZFaj; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732630AbeKLJrm (ORCPT + 99 others); Mon, 12 Nov 2018 04:47:42 -0500 Received: from mail.kernel.org ([198.145.29.99]:35336 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732514AbeKLISL (ORCPT ); Mon, 12 Nov 2018 03:18:11 -0500 Received: from localhost (unknown [206.108.79.134]) (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 BD0B921508; Sun, 11 Nov 2018 22:28:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541975295; bh=BuuW1AFSt5RgMIqSwGI6lSo+8ObcGDSbL0F2MKuf3TY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=E9prZFaj1Gz6EKu0zrYrHnCiXmMFR8qTkUXlHHLAuwNUYPJgXHssMtlZFu6+ZToTf KQE1VVrhG44mwGx51lI74JlAj0802VPu0J0Mmqxr8APD0QVQJ7yWecNWpBChJxPnUJ SR19KE20zv+CiqtqRUeRrpgqL5Bf2xrw8KlNSSnc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mikulas Patocka , Herbert Xu Subject: [PATCH 4.19 244/361] crypto: aesni - dont use GFP_ATOMIC allocation if the request doesnt cross a page in gcm Date: Sun, 11 Nov 2018 14:19:51 -0800 Message-Id: <20181111221652.607603138@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181111221619.915519183@linuxfoundation.org> References: <20181111221619.915519183@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review 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 4.19-stable review patch. If anyone has any objections, please let me know. ------------------ From: Mikulas Patocka commit a788848116454d753b13a4888e0e31ada3c4d393 upstream. This patch fixes gcmaes_crypt_by_sg so that it won't use memory allocation if the data doesn't cross a page boundary. Authenticated encryption may be used by dm-crypt. If the encryption or decryption fails, it would result in I/O error and filesystem corruption. The function gcmaes_crypt_by_sg is using GFP_ATOMIC allocation that can fail anytime. This patch fixes the logic so that it won't attempt the failing allocation if the data doesn't cross a page boundary. Signed-off-by: Mikulas Patocka Cc: stable@vger.kernel.org Signed-off-by: Herbert Xu Signed-off-by: Greg Kroah-Hartman --- arch/x86/crypto/aesni-intel_glue.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/arch/x86/crypto/aesni-intel_glue.c +++ b/arch/x86/crypto/aesni-intel_glue.c @@ -817,7 +817,7 @@ static int gcmaes_crypt_by_sg(bool enc, /* Linearize assoc, if not already linear */ if (req->src->length >= assoclen && req->src->length && (!PageHighMem(sg_page(req->src)) || - req->src->offset + req->src->length < PAGE_SIZE)) { + req->src->offset + req->src->length <= PAGE_SIZE)) { scatterwalk_start(&assoc_sg_walk, req->src); assoc = scatterwalk_map(&assoc_sg_walk); } else {