From: Ilya Krutskih <devsec@tpz.ru>
To: Mauro Carvalho Chehab <mchehab@kernel.org>
Cc: Ilya Krutskih <devsec@tpz.ru>,
linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
lvc-patches@linuxtesting.org, lvc-project@linuxtesting.org,
stable@vger.kernel.org
Subject: [PATCH v5] media: dvb: mb86a16: fix array overflow in mb86a16_set_fe()
Date: Tue, 24 Mar 2026 16:11:45 +0000 [thread overview]
Message-ID: <20260324161146.532632-1-devsec@tpz.ru> (raw)
The size of prev_swp_freq[] is a fixed constant unrelated to
the number of possible detection attempts. Index 'prev_freq_num'
of array 'prev_swp_freq' is incremented by each step in cycle.
If index exceeds the total length of array, an out-of-bounds
access might happen, in case of repeated unsuccessful signal
acquisition. Add check to prevent this.
Cc: stable@vger.kernel.org
Fixes: 41e840b13e11 ("V4L/DVB (13699): [Mantis, MB86A16] Initial checkin: Mantis, MB86A16")
Signed-off-by: Ilya Krutskih <devsec@tpz.ru>
---
v2: Add check for array's length on each cycle step,
edit patch description, edit tag 'fixes'.
https://lore.kernel.org/all/20251211172251.852254-1-devsec@tpz.ru/
v3: Edit condition to > ARRAY_SIZE() - 1, add a reason because of
overflow can happen in description of patch
v4: Edit condition to >= ARRAY_SIZE()
v5: delete unnecessary check after incrementing
drivers/media/dvb-frontends/mb86a16.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/media/dvb-frontends/mb86a16.c b/drivers/media/dvb-frontends/mb86a16.c
index 9033e39d75f4..5fabb6b884b5 100644
--- a/drivers/media/dvb-frontends/mb86a16.c
+++ b/drivers/media/dvb-frontends/mb86a16.c
@@ -1157,6 +1157,10 @@ static int mb86a16_set_fe(struct mb86a16_state *state)
v = 0;
while (loop == 1) {
+ if (prev_freq_num >= ARRAY_SIZE(prev_swp_freq)) {
+ dprintk(verbose, MB86A16_ERROR, 1, "Signal detection retry attempts failed");
+ return -1;
+ }
swp_info_get(state, fOSC_start, state->srate,
v, R, swp_ofs, &fOSC,
&afcex_freq, &AFCEX_L, &AFCEX_H);
--
2.43.0
reply other threads:[~2026-03-24 16:20 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=20260324161146.532632-1-devsec@tpz.ru \
--to=devsec@tpz.ru \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=lvc-patches@linuxtesting.org \
--cc=lvc-project@linuxtesting.org \
--cc=mchehab@kernel.org \
--cc=stable@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