]> git.ipfire.org Git - thirdparty/linux.git/commit
can: softing: fw_parse(): validate firmware record spans
authorPengpeng Hou <pengpeng@iscas.ac.cn>
Wed, 22 Jul 2026 04:43:47 +0000 (12:43 +0800)
committerMarc Kleine-Budde <mkl@pengutronix.de>
Wed, 29 Jul 2026 10:00:00 +0000 (12:00 +0200)
commit856d6cb04e5407523566b075841dcd6423757d1c
tree8f58fda9b2e8691a40a4c491a81726f0ba9723ca
parentbef9004c5b91debfceaea2841855a4ebe81ff2b3
can: softing: fw_parse(): validate firmware record spans

fw_parse() reads a fixed record header, a firmware-provided payload,
and a trailing checksum without knowing the end of the firmware blob. A
truncated record can therefore make those reads exceed the blob.

The same record also supplies addresses and lengths for writes into
DPRAM. The generic loader uses wrap-prone mixed signed arithmetic for its
bounds check, while the application loader does not bound the staging
copy at all.

Pass the firmware end to the parser and validate the full source record.
Use a signed wide offset for generic DPRAM records and validate the
application staging span against the mapped DPRAM before copying.

Fixes: 03fd3cf5a179 ("can: add driver for Softing card")
Signed-off-by: Pengpeng Hou <pengpeng@iscas.ac.cn>
Link: https://patch.msgid.link/20260722044347.2708-1-pengpeng@iscas.ac.cn
Cc: stable@kernel.org
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
drivers/net/can/softing/softing_fw.c