From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 71721CDB474 for ; Mon, 16 Oct 2023 14:24:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233445AbjJPOYa (ORCPT ); Mon, 16 Oct 2023 10:24:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41786 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232381AbjJPOYa (ORCPT ); Mon, 16 Oct 2023 10:24:30 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 73DB89C for ; Mon, 16 Oct 2023 07:24:28 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BA3B1C433C8; Mon, 16 Oct 2023 14:24:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1697466268; bh=73Q+X8gRwVJodVh8+NHPOYxWeuOvAWFRgAex7T2LS54=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bHSSA2fng82E/ZrVec/Id874YW46RkPPGzJK398Y6NYi45bYmoosD5jRWCvui9NiR iDMDo33FOs3dfcMsF9VPf55DR8xEx7utlTLp/AXPUnajlqRKPi3cwcQ08FKCoBOL8T E4h8JZzGcwicWfcnnVLF+VB8Qk3RAPbKto26+qaA= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, =?UTF-8?q?Tatu=20Heikkil=C3=A4?= , Mike Snitzer , Herbert Xu Subject: [PATCH 6.5 018/191] dm crypt: Fix reqsize in crypt_iv_eboiv_gen Date: Mon, 16 Oct 2023 10:40:03 +0200 Message-ID: <20231016084015.827734362@linuxfoundation.org> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231016084015.400031271@linuxfoundation.org> References: <20231016084015.400031271@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org 6.5-stable review patch. If anyone has any objections, please let me know. ------------------ From: Herbert Xu commit 152d0bcdf1efcb54a4fa20f694e9c7bbb6d06cbf upstream. A skcipher_request object is made up of struct skcipher_request followed by a variable-sized trailer. The allocation of the skcipher_request and IV in crypt_iv_eboiv_gen is missing the memory for struct skcipher_request. Fix it by adding it to reqsize. Fixes: e3023094dffb ("dm crypt: Avoid using MAX_CIPHER_BLOCKSIZE") Cc: #6.5+ Reported-by: Tatu Heikkilä Reviewed-by: Mike Snitzer Signed-off-by: Herbert Xu Signed-off-by: Greg Kroah-Hartman --- drivers/md/dm-crypt.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c index f2662c21a6df..5315fd261c23 100644 --- a/drivers/md/dm-crypt.c +++ b/drivers/md/dm-crypt.c @@ -753,7 +753,8 @@ static int crypt_iv_eboiv_gen(struct crypt_config *cc, u8 *iv, int err; u8 *buf; - reqsize = ALIGN(crypto_skcipher_reqsize(tfm), __alignof__(__le64)); + reqsize = sizeof(*req) + crypto_skcipher_reqsize(tfm); + reqsize = ALIGN(reqsize, __alignof__(__le64)); req = kmalloc(reqsize + cc->iv_size, GFP_NOIO); if (!req) -- 2.42.0