From: Junlin Li <make24@iscas.ac.cn>
To: mchehab@kernel.org, tzimmermann@suse.de, peda@axentia.se,
wsa+renesas@sang-engineering.com, hkallweit1@gmail.com,
laurent.pinchart+renesas@ideasonboard.com
Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
Junlin Li <make24@iscas.ac.cn>
Subject: [PATCH] drivers: media: dvb-frontends/rtl2832: fix an out-of-bounds write error
Date: Tue, 2 Jul 2024 21:24:13 +0800 [thread overview]
Message-ID: <20240702132413.4318-1-make24@iscas.ac.cn> (raw)
Ensure index in rtl2830_pid_filter
does not exceed 31 to prevent out-of-bounds access.
dev->filters is a 32-bit value,
so set_bit and clear_bit functions should only
operate on indices from 0 to 31.
If index is 32, it will attempt to access a non-existent 33rd bit,
leading to out-of-bounds access.
Change the boundary check
from index > 32 to index >= 32 to resolve this issue.
Signed-off-by: Junlin Li <make24@iscas.ac.cn>
---
drivers/media/dvb-frontends/rtl2832.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/media/dvb-frontends/rtl2832.c b/drivers/media/dvb-frontends/rtl2832.c
index 5142820b1b3d..76c3f40443b2 100644
--- a/drivers/media/dvb-frontends/rtl2832.c
+++ b/drivers/media/dvb-frontends/rtl2832.c
@@ -983,7 +983,7 @@ static int rtl2832_pid_filter(struct dvb_frontend *fe, u8 index, u16 pid,
index, pid, onoff, dev->slave_ts);
/* skip invalid PIDs (0x2000) */
- if (pid > 0x1fff || index > 32)
+ if (pid > 0x1fff || index >= 32)
return 0;
if (onoff)
--
2.34.1
next reply other threads:[~2024-07-02 13:25 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-02 13:24 Junlin Li [this message]
2024-07-03 16:08 ` Markus Elfring
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=20240702132413.4318-1-make24@iscas.ac.cn \
--to=make24@iscas.ac.cn \
--cc=hkallweit1@gmail.com \
--cc=laurent.pinchart+renesas@ideasonboard.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=peda@axentia.se \
--cc=tzimmermann@suse.de \
--cc=wsa+renesas@sang-engineering.com \
/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
all inboxes | Powered by JetHome®