Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2531203imu; Thu, 29 Nov 2018 06:29:22 -0800 (PST) X-Google-Smtp-Source: AFSGD/VULCEuIeVyjriyS/jwNkGIgi/wP1HrLxYlEnnmRJ/P3sr0Yy1tLkDeP7hQ5zl5C9UeiSje X-Received: by 2002:a65:66ce:: with SMTP id c14mr236818pgw.450.1543501762295; Thu, 29 Nov 2018 06:29:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543501762; cv=none; d=google.com; s=arc-20160816; b=o6KAfxFr9M0vTvICdfqHrvcWW0S0vu3ymVllcMc4lmooDVifMMak/PfD/NOR0S+UPZ 7sJ5BfP22cFddeWkZ9JI+qQyaHjeOOhTSWBxngQvD/juBhVf7T1C5wS4TLgI+ok2A28J 1/UEHIW3V6JmB1Z5LT5TjccbWnazpSjqOuBypRSiYIeUdnbmP3JGypm1tHYAKO26Ya0e 4CHx0G1anRAg/rGevYfEYs/iEBSrIOUZf9CbhLOumoj/6cOrm3BspqcTPup33cU9u0uq wWDjHWpGBFg/9t6k5YlMmTPDzbEVEJuhT9c7ulQdYE05vTn28PF0KPKUkIfAyh4Qz1dc fV4w== 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=+Lfkuwld0jjGYVjMyZi46brmuZKtT8HsJXAWfASGcEU=; b=wQ959tQaeL1XJ1PP1gCj+gpw8cbIWHjnoAFd4LPqcN9pkrrJsShe6PKkxApqTaD0lK I3/ecNUVaUuywWTSTVAQibciIaIcg/tJpe0X/oINZppfCpWxdhNEDhWeKN+OaH7nBnWk j0f8Nho2Tqp4E4bkK8Uw2AlVvXoUapXgNPDZytEOnt2vNiXZrfsAitdW1kvdaNmnTb1f OCTJu2PdE60SPoNCJCs/91MOF1psXxg7CQdg/vegyzDBQPg51DTSz3Zjkx/3e0c6hxxU 6VP/Nu65vG1deSPYiYE11AslbLa72Qq5JPNH6x96NuSjJbZr+E0yGX57K9M0r+jcB7w/ DCaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Bxecst1V; 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 n15si1948109pgk.27.2018.11.29.06.29.07; Thu, 29 Nov 2018 06:29:22 -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=Bxecst1V; 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 S2387617AbeK3Bcq (ORCPT + 99 others); Thu, 29 Nov 2018 20:32:46 -0500 Received: from mail.kernel.org ([198.145.29.99]:32904 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731824AbeK3Bcp (ORCPT ); Thu, 29 Nov 2018 20:32:45 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.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 75E6D2145D; Thu, 29 Nov 2018 14:27:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1543501632; bh=ofNV4QAPxgtnBTl5XdVIjMNGIWLTVnaFw7h7XYnYt0M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Bxecst1VZ2DXg6InrXvrOu7abNB5FrUDN4XaBQU5o47UOU9OwT+V5LNtFfCgCGqWx q0CSUrURMxRzwh6iuZeyVui5U88RT4jLkxewavqfr8/o4Dk05LkqoSgNSArvplkykh lQ8F5hpIamWGzudogzQjX8FsJqqjmVhC7L8XHx6M= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Qian Cai , Ard Biesheuvel , Herbert Xu , Sasha Levin Subject: [PATCH 4.14 050/100] crypto: simd - correctly take reqsize of wrapped skcipher into account Date: Thu, 29 Nov 2018 15:12:20 +0100 Message-Id: <20181129140103.531566501@linuxfoundation.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181129140058.768942700@linuxfoundation.org> References: <20181129140058.768942700@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.14-stable review patch. If anyone has any objections, please let me know. ------------------ [ Upstream commit 508a1c4df085a547187eed346f1bfe5e381797f1 ] The simd wrapper's skcipher request context structure consists of a single subrequest whose size is taken from the subordinate skcipher. However, in simd_skcipher_init(), the reqsize that is retrieved is not from the subordinate skcipher but from the cryptd request structure, whose size is completely unrelated to the actual wrapped skcipher. Reported-by: Qian Cai Signed-off-by: Ard Biesheuvel Tested-by: Qian Cai Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin --- crypto/simd.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/crypto/simd.c b/crypto/simd.c index 88203370a62f..894c62944106 100644 --- a/crypto/simd.c +++ b/crypto/simd.c @@ -126,8 +126,9 @@ static int simd_skcipher_init(struct crypto_skcipher *tfm) ctx->cryptd_tfm = cryptd_tfm; - reqsize = sizeof(struct skcipher_request); - reqsize += crypto_skcipher_reqsize(&cryptd_tfm->base); + reqsize = crypto_skcipher_reqsize(cryptd_skcipher_child(cryptd_tfm)); + reqsize = max(reqsize, crypto_skcipher_reqsize(&cryptd_tfm->base)); + reqsize += sizeof(struct skcipher_request); crypto_skcipher_set_reqsize(tfm, reqsize); -- 2.17.1