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=1796209483; b=i2Kk+cfpf1XGmkx8fX35Poa+wCxjNj6f2nrRV6DrWJl34leEdAj9VOlvJzhceI90yWHK aQAOC4zWpNHBJ4RYdR14oPfNyRGIlXfDodDN3JO2UchVYmElrW0rbiDHNdM/Qa3QVfut/ aeS85G8yJSgqUaigWYsAITDWOqBRKF9Ff97Nh6ntqHQwqxhWCcPch7XxBAOWaAI4uKKi7 pdcbrS/Pm6vhpd1jGDzb7Cg6P1dl412AI4Yhg4q3mXLdE+2UcX8pBsCeGdaynwDwpyh+t aIm532zDOVYBMZ7iwTPRMpiXBIrK5eeDAnUYidz3VpZyDFEeplmrKqKj/8MRc3HSPsw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796209483; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=LKL2lpi0mlmx2Mxs8yjtYzj/gdo16kkWX9nGTqOI/Os=; b=EWJnareCMBIHKS8HwEQFh34oh/HxG1F8B+xDSKRFCmAwUcWmZyNcQNiscJpD+I4Gkd3x O9TmrQWostD0cBtKvZ3k7HnpZBlS07YjNxKmtgliSKXPK3wqf8lLSv4tX6QndvOOPBmwH yk4nin2igW+DyiLhmYLJGodZwkBJERJEVAL6YOO7Q+9OYb/JtEGu1skDDBTHyMpWByivS U+u8H1RTEpgvkZt4FGSwKbKUFiPjBc1LZho136jx34eVuWCYn/eusJFxCqN61gd3OGVwV m+Fkz+DrD3JuFe1Z+7x7mSAvIJvT8eLHM7y7Xt4G2xjbwGMLmPQ9L3WXshUts35BY6Q== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b="SedEu/Z9"; 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 ABF72606A31A; Wed, 2 Dec 2026 11:04:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=SedEu/Z9 Received: by smtp.kernel.org (Postfix) with ESMTPSA id CB6161F000C1; Wed, 2 Dec 2026 11:04:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796209483; bh=LKL2lpi0mlmx2Mxs8yjtYzj/gdo16kkWX9nGTqOI/Os=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=SedEu/Z9noz0nesHzqcql1ulbIqpbYJTLTT+EceSlqzZvZWXbjnV+gbxm0LSsyssX B3PDyJ3e/j04jbhrF50Z9smRrXaL5M5x7wpWvOCDix0Q2iay3Qh1XFW8+aFptSFueo W/Mj1cMz6CtRCYMvQgqx3IoAR9h5z/JZlEpMCWjnly56Oi0VQqS4X3rPTBE/Txxn2B KP8a3XC9sUjr1N5brRhYrR0MKvQte/Cd/xTsmHMvY4kGgdzF+Qgt4zAvDycpn0QKzP w7Y7sjKexM4nwT0mbKniiA8AGGKQpfn2HaMHVfgVK8VsbCi3GPIP9cL92nqJIV9PH4 rKRHPE8j77QWA== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v15 22/35] arm64: dts: amlogic: a1: add crypto node Reply-To: sashiko-reviews@lists.linux.dev To: "Jose Nieto" , "Corentin Labbe" , "Herbert Xu" , "David S . Miller" Cc: linux-crypto@vger.kernel.org, linux-amlogic@lists.infradead.org, devicetree@vger.kernel.org, "Neil Armstrong" , "Kevin Hilman" , "Jerome Brunet" , "Martin Blumenstingl" , "Rob Herring" , "Krzysztof Kozlowski" , "Conor Dooley" , "Alexey Romanov" In-Reply-To: <20261202101036.116145-2-jnieto.alaber@gmail.com> References: <20261202100714.115460-1-jnieto.alaber@gmail.com> <20261202101036.116145-1-jnieto.alaber@gmail.com> <20261202101036.116145-2-jnieto.alaber@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Wed, 02 Dec 2026 11:04:42 +0000 X-Mailing-List: linux-crypto@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [High] crypto: amlogic: spurious 0-byte DMA descriptor kicked on non-final update() -- commit ff964c96b4100428730593b5607575d70a5cdce6 Author: Alexey Romanov arm64: dts: amlogic: a1: add crypto node This commit adds the crypto engine and clk81 device tree nodes for Amlogic A1 SoCs to enable hardware SHA and AES acceleration. > diff --git a/arch/arm64/boot/dts/amlogic/meson-a1.dtsi b/arch/arm64/boot/= dts/amlogic/meson-a1.dtsi > index 6f6a6145cba12..396260b7b3989 100644 > --- a/arch/arm64/boot/dts/amlogic/meson-a1.dtsi > +++ b/arch/arm64/boot/dts/amlogic/meson-a1.dtsi > @@ -686,6 +686,14 @@ sd_emmc: mmc@10000 { > assigned-clocks =3D <&clkc_periphs CLKID_SD_EMMC>; > assigned-clock-rates =3D <24000000>; > }; > + > + crypto: crypto@6000 { > + compatible =3D "amlogic,a1-crypto"; > + reg =3D <0x0 0x6000 0x0 0x48>; > + interrupts =3D ; > + clocks =3D <&clk81>; > + power-domains =3D <&pwrc PWRC_DMA_ID>; > + }; > }; [Severity: High] Can a non-final SHA update() in the hasher driver (added earlier in this series in commit "crypto: amlogic - Introduce hasher") queue and kick a spurious 0-byte DMA descriptor at physical address 0? drivers/crypto/amlogic/amlogic-gxl-hasher.c:meson_hasher_do_one_request() { ... meson_setup_state_descs(&ctx); if (rctx->partial_size && rctx->partial_size < blocksize) { ret =3D meson_fill_partial_buffer(&ctx, len); if (ret) goto fail; } else if (len && len < blocksize) { memcpy(rctx->partial, sg_virt(ctx.src_sg) + ctx.src_offset, len); rctx->partial_size =3D len; ctx.nbytes -=3D len; ctx.src_offset +=3D len; } else if (len) { ... if (!ctx.todo && ctx.nbytes) continue; if (!ctx.todo && rctx->final_req && rctx->partial_size) continue; if (!ctx.todo && !rctx->final_req && !ctx.tloffset) continue; if (meson_setup_data_descs(&ctx)) { ret =3D meson_kick_hardware(&ctx); if (ret) goto fail; } } For a non-final update() whose length is greater than one 64-byte block but not a multiple of 64 (for example, 100 bytes), the first iteration queues the 64-byte block at flow->tl[0], increments ctx.tloffset, and leaves ctx.nbytes =3D 36. Because ctx.nbytes is non-zero, meson_setup_data_descs() does not set DESC_LAST and does not kick the hardware. In the next iteration, the remaining 36 bytes are copied into rctx->partial, setting ctx.nbytes =3D 0 while ctx.todo =3D 0 and ctx.src_addr =3D 0. Because ctx.nbytes is 0, rctx->final_req is false, and ctx.tloffset is non-zero, none of the three continue checks match. Execution falls through to meson_setup_data_descs() and meson_kick_hardware(), appending an extra 0-byte SHA descriptor with t_src =3D 0 and DESC_LAST (without DESC_END) that corrupts the hardware SHA digest state. The same happens on any subsequent non-final update() shorter than blocksize once rctx->begin_req is false, because meson_setup_state_descs() advances ctx.tloffset before buffering the tail bytes. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261202100714.1154= 60-1-jnieto.alaber@gmail.com?part=3D22