From patchwork Tue Apr 5 07:27:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 556549 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 43F43C47084 for ; Tue, 5 Apr 2022 12:26:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379144AbiDEMYE (ORCPT ); Tue, 5 Apr 2022 08:24:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60512 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356132AbiDEKW7 (ORCPT ); Tue, 5 Apr 2022 06:22:59 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 050D0B7C4C; Tue, 5 Apr 2022 03:06:31 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id A40A0B81C83; Tue, 5 Apr 2022 10:06:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F27EDC385A2; Tue, 5 Apr 2022 10:06:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649153188; bh=ptSRzUMxPsDpFQvmnSaM+FCNXlPRlJK5ik2D7AfvW6I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rA9JlnT4nkaxZ26Og3CGjmGLUZUVgHaqh+OL/VaqQk3/KjCMAfvecS/Inpu3rlMhq Bz1Aq7U4OjlpQN26/qVxdeKfqNZa8dl6MHhz3zvPpwdQB6Wgn8i/U2YCyxFFXm1l3X ztVmMBxvTboc6iUkkQ5D1aAOIiMLP2p8QxcJviqI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tomas Paukrt , Herbert Xu , Sasha Levin Subject: [PATCH 5.10 134/599] crypto: mxs-dcp - Fix scatterlist processing Date: Tue, 5 Apr 2022 09:27:08 +0200 Message-Id: <20220405070302.829074106@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220405070258.802373272@linuxfoundation.org> References: <20220405070258.802373272@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Tomas Paukrt [ Upstream commit 28e9b6d8199a3f124682b143800c2dacdc3d70dd ] This patch fixes a bug in scatterlist processing that may cause incorrect AES block encryption/decryption. Fixes: 2e6d793e1bf0 ("crypto: mxs-dcp - Use sg_mapping_iter to copy data") Signed-off-by: Tomas Paukrt Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin --- drivers/crypto/mxs-dcp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/crypto/mxs-dcp.c b/drivers/crypto/mxs-dcp.c index 5edc91cdb4e6..a9d3e675f7ff 100644 --- a/drivers/crypto/mxs-dcp.c +++ b/drivers/crypto/mxs-dcp.c @@ -330,7 +330,7 @@ static int mxs_dcp_aes_block_crypt(struct crypto_async_request *arq) memset(key + AES_KEYSIZE_128, 0, AES_KEYSIZE_128); } - for_each_sg(req->src, src, sg_nents(src), i) { + for_each_sg(req->src, src, sg_nents(req->src), i) { src_buf = sg_virt(src); len = sg_dma_len(src); tlen += len;