mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2] media: dvb-frontends: ds3000: validate firmware size
@ 2026-09-20  3:51 Pengpeng Hou
  0 siblings, 0 replies; only message in thread
From: Pengpeng Hou @ 2026-09-20  3:51 UTC (permalink / raw)
  To: mchehab; +Cc: linux-media, linux-kernel, corbet, hppiscas

The firmware diagnostic accesses the first two and last two bytes
without proving that the image contains two bytes. An undersized image
can therefore be read outside its bounds when the diagnostic is enabled.

Reject images smaller than two bytes before the diagnostic or upload
path consumes them.

The issue was found by our static-analysis tool.

Fixes: 09ea33e5c696 ("V4L/DVB (13493): TeVii S470 and TBS 6920 fixes")
Assisted-by: gpt 5
Signed-off-by: Pengpeng Hou <hppiscas@163.com>
---
Changes since v1:
https://lore.kernel.org/all/20260830124034.95459-1-pengpeng@iscas.ac.cn/
Include the tool-discovery and coding-assistance provenance requested by
Jonathan Corbet; retain the two-byte minimum check.

 drivers/media/dvb-frontends/ds3000.c |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/media/dvb-frontends/ds3000.c b/drivers/media/dvb-frontends/ds3000.c
index ce7ae424b27c..9cc97ca7bbcc 100644
--- a/drivers/media/dvb-frontends/ds3000.c
+++ b/drivers/media/dvb-frontends/ds3000.c
@@ -373,6 +373,9 @@ static int ds3000_load_firmware(struct dvb_frontend *fe,
 	struct ds3000_state *state = fe->demodulator_priv;
 	int ret = 0;
 
+	if (fw->size < 2)
+		return -EINVAL;
+
 	dprintk("%s\n", __func__);
 	dprintk("Firmware is %zu bytes (%02x %02x .. %02x %02x)\n",
 			fw->size,

base-commit: 518e5b794c06c0f0eb40df3e202274a66202c137
-- 
2.50.1 (Apple Git-155)


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-09-20  3:51 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-20  3:51 [PATCH v2] media: dvb-frontends: ds3000: validate firmware size Pengpeng Hou

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®