Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2542888imu; Thu, 29 Nov 2018 06:39:04 -0800 (PST) X-Google-Smtp-Source: AFSGD/UqnbibbVBQ4CcsNGQJTo9v/c7tV/61U7EeYF3qpJaZMmlaH632gDCQDtV/Xtp1ZSBOhXHr X-Received: by 2002:a63:d949:: with SMTP id e9mr1483477pgj.24.1543502343959; Thu, 29 Nov 2018 06:39:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543502343; cv=none; d=google.com; s=arc-20160816; b=Vr34kjbmh5hziLTn0k+SObNloKWMRj2N/X5CMfuGCQvuTNE60lvqvH+woAOatO8w5f ST8yx8Nx1PbHAFPok1abxMGEIOrnGO3PPHOki5RMnX2UZmqTEcvhVKZvUokPaQVvfMl6 Bx+aXefZXA6PKlRbhUPrnfj9AJh74mAH1uYdhm6Pb4RjjjK3swJsrcFpmupdXI+tFbgY jZrhuffxyk12J4KQ5HzTx1kg5L2dSrvkZeun/Rpee3HUoGSPIq64gLn/95BOr9dOEphj Ykp3B0b4fYdqq0Bob1oD37kfx7pKIUVyjkyGHPWGGrpR09PbeSn4tqZqlBxraNvtvQ0G 8zmw== 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=QVUZnDWuE0Tk83eMC+xsYYw+hBtb7Oarp6CUcucLkEU=; b=qxgBX8/ZdLOFOEaKjQ7V7owYckg/HFHuo4Vz8tLSPxAxNSQvIGYbutJkuv8kPBnMPW VS393vdQFGZg9LlqGQ8G1MWYDWZUGRje1DoWImOG71T68awQYwXItc1EfXaWWgsRnJ41 Hi6ZlRh71AmDeT70NTXOAv2X7tsCs6ltCis9oem29LZa2zLW7K/wImHn5OQ1lpRsFDXi hVf2f34hG5UFZmXv6OPbhxOtQBwt5sjQVrXogLNtYnQMw3JePi353BDpitrm76GUhc3/ TgjMQEi7qVLO7xoi42w7pwP2s9DRF1ehrpPj7OVep1eNf/ZU+cmzyxfkT2ktr3ul8DHi 3lCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="U3u/aHOT"; 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 b12si2198953plx.159.2018.11.29.06.38.48; Thu, 29 Nov 2018 06:39:03 -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="U3u/aHOT"; 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 S2389075AbeK3Bgu (ORCPT + 99 others); Thu, 29 Nov 2018 20:36:50 -0500 Received: from mail.kernel.org ([198.145.29.99]:39436 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389060AbeK3Bgt (ORCPT ); Thu, 29 Nov 2018 20:36:49 -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 224682146F; Thu, 29 Nov 2018 14:31:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1543501876; bh=q5KqIS6xm3VU6CookUFgEdfwyfD4dWXDjhfzR5fhLGA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=U3u/aHOTWeIbBlU/TxOSmGygqhbQETvK5w30HIFzkd1sg15zA5VJ/j6cmmQ5Vufj8 pH1CszBEKEPOvJrRBLievVfBVTvZNddSSvt+Of1uX0EYAUWYlTKTYdDd3pttJGhme5 sp955GfGMbcBseani1MY4Z35VwTPNIAY9eA+6seM= 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.19 077/110] crypto: simd - correctly take reqsize of wrapped skcipher into account Date: Thu, 29 Nov 2018 15:12:48 +0100 Message-Id: <20181129135924.364398822@linuxfoundation.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181129135921.231283053@linuxfoundation.org> References: <20181129135921.231283053@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. ------------------ [ 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 ea7240be3001..78e8d037ae2b 100644 --- a/crypto/simd.c +++ b/crypto/simd.c @@ -124,8 +124,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