Linux Media Controller development
 help / color / mirror / Atom feed
From: Maksim Pinigin <pinigin@mapicom.org>
To: linux-media@vger.kernel.org
Subject: [PATCH] media: dw2102: Fix a buffer overflow
Date: Sun, 05 Jul 2026 19:41:03 +0700	[thread overview]
Message-ID: <19e4a6eefaf3911f439ef565d8ac191b@mapicom.org> (raw)

This bug in dw2102_load_firmware() function appears only when building 
the kernel via LLVM+Clang. Due to reading of 64 bytes chunk, it may 
happen that there will be an attempt to read a more bytes in chunk than 
there is left, which is why Kernel oops occurs.
At least this bug happens when downloading the firmware for Prof 
Revolution DVB-S2 7500 USB.

Signed-off-by: Maksim Pinigin <pinigin@mapicom.org>
---
  drivers/media/usb/dvb-usb/dw2102.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/usb/dvb-usb/dw2102.c 
b/drivers/media/usb/dvb-usb/dw2102.c
index 4fecf2f965e9..ad90d7be4412 100644
--- a/drivers/media/usb/dvb-usb/dw2102.c
+++ b/drivers/media/usb/dvb-usb/dw2102.c
@@ -1893,7 +1893,7 @@ static int dw2102_load_firmware(struct usb_device 
*dev,
                 break;
         }
         info("start downloading DW210X firmware");
-       p = kmalloc(fw->size, GFP_KERNEL);
+       p = kzalloc(round_up(fw->size, 0x40), GFP_KERNEL);
         reset = 1;
         /*stop the CPU*/
         dw210x_op_rw(dev, 0xa0, 0x7f92, 0, &reset, 1, DW210X_WRITE_MSG);
-- 
2.39.5

                 reply	other threads:[~2026-07-05 12:41 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=19e4a6eefaf3911f439ef565d8ac191b@mapicom.org \
    --to=pinigin@mapicom.org \
    --cc=linux-media@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox