From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796387493; b=QgmAjREdUMpBGoCwACigJzB2h9gd4QksIZH6d++6MGwzNRIjVGlnylrH9a+XklQRootA rNI2mSc3gosSfTv2vbySUnbYJb9DdgmXXOR4l2EZiufbhH9y3l3tlydb9IMaoLVnvlNwL E0uDUZABuclDG4g2qRILiWiydb3Ke4yCWY8OY74KyY+wByHQjT3Y4Jp0UnCP5fniRou8v ViiJCQkUtwLVOIdZ2V37xL0C3juOWscffYimTveiOZBjUG2sxH0lpHrYfxF/U1dPeUUsH IDKEhRQ31fkhIBTWI33CUVEiTaRdhBnmi15TTArgNAoIJkzunuCaoaMRc3HQMKd1bIg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796387493; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=gCV2x9OW9mZdLNHOpyL1XFDcYY4nCaa481kE4ClTf6Y=; b=V9JqyS4EsUtR5uICFUwe1CNjarrLvsdMlyZ09ixhDOduKCQWee1iLHguY0bHP9C0QWki Mhirr9LrZoyeewsYUx6l8MP7CkbIPok49heMJUI0x86QnxIet/d+ui+0rL16jh+aP6MHT TtlvKOkB9NLnaUMS/oM2HJccL3TBej2KbDGTDkjYIhLUdobcOF18B4g1I3SQAzSW2iFsx SnZQj8huduedqIFeDGGlmMMHjDpsF+Pcm426x9R66p2jkUxkDUbc9xDvL1591uxjtdflZ VSu2HHlfAqhJ2iUw5TSL4Qynm/9WwFAqbsqgaVO1lOMwjQFCaimqXDtbFTiNiNsLQ+w== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=wXJaWo2a; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E4AED606A322; Fri, 4 Dec 2026 12:31:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=wXJaWo2a Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5BE8C1F00897; Fri, 4 Dec 2026 12:31:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796387492; bh=gCV2x9OW9mZdLNHOpyL1XFDcYY4nCaa481kE4ClTf6Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=wXJaWo2aNktKwhcL/GZYPh2n1PYX4JzwDfMLbnO9Ht3JSGti1euW1IzznSSQyJITz IqrZmWz0RLxmQ+1T+IJ4XEpUCEWsCH548HTkgbHCTgZWwye6eUsmRhZ3a1eTJ8ZS1p UKE5kpiiq96dbmDbhVYCYN4qRVZa0hlRo3a3TvdA= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Linmao Li , Herbert Xu , Sasha Levin Subject: [PATCH 6.1 0266/1059] crypto: mxs-dcp - handle zero-length skcipher requests Date: Fri, 4 Dec 2026 18:56:37 +0900 Message-ID: <20261204100651.166029681@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100643.980430235@linuxfoundation.org> References: <20261204100643.980430235@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Linmao Li [ Upstream commit ac1d6a65a1e1f069f119df42c6b57dbdff5f6be8 ] Zero-length skcipher requests are valid no-ops, but MXS-DCP queues them. When such a request reaches the worker, last_out_len remains zero. The CBC completion path then subtracts AES_BLOCK_SIZE from this unsigned value when updating the IV, causing the offset to underflow. On decryption, the resulting source address precedes aes_in_buf. Return success before enqueueing zero-length requests. This avoids the invalid source access and leaves the IV unchanged for a no-op. Fixes: fadd7a6e616b ("crypto: mxs-dcp - Fix AES issues") Signed-off-by: Linmao Li Signed-off-by: Herbert Xu [ sashal: Dropped the unbackported key_referenced condition from the context line, keeping the existing key_len check and adding the same early return for zero-length requests before it. ] Signed-off-by: Sasha Levin --- drivers/crypto/mxs-dcp.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/crypto/mxs-dcp.c b/drivers/crypto/mxs-dcp.c index 702ab2c6c38e7..cc8b1b23550de 100644 --- a/drivers/crypto/mxs-dcp.c +++ b/drivers/crypto/mxs-dcp.c @@ -453,6 +453,9 @@ static int mxs_dcp_aes_enqueue(struct skcipher_request *req, int enc, int ecb) struct dcp_aes_req_ctx *rctx = skcipher_request_ctx(req); int ret; + if (!req->cryptlen) + return 0; + if (unlikely(actx->key_len != AES_KEYSIZE_128)) return mxs_dcp_block_fallback(req, enc); -- 2.53.0