From: Guo Zihao <guozh23@xiaopeng.com>
To: Mauro Carvalho Chehab <mchehab@kernel.org>
Cc: "Igor M . Liplianin" <liplianin@me.by>,
linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org
Subject: [PATCH] media: dvb-frontends: si21xx: validate fec_inner before coderates[] lookup
Date: Thu, 29 Oct 2026 15:26:04 +0800 [thread overview]
Message-ID: <20261029072604.4135019-1-guozh23@xiaopeng.com> (raw)
si21xx_setacquire() indexes the 10-element coderates[] array with the
crate argument, which comes from the user-controlled DTV_INNER_FEC
property. dvb_frontend_check_parameters() only validates frequency
and symbol_rate, so the value reaches the array lookup unchecked:
coderate_ptr = coderates[crate];
The enum fe_code_rate range however goes well beyond the table: the
uapi header defines values up to FEC_11_15 = 18, so even a perfectly
legal code rate request such as FEC_9_10 (11), set through the
DTV_INNER_FEC property or a legacy FE_SET_FRONTEND ioctl, indexes
past the end of the array, and arbitrary u32 values overflow it
outright. The byte read out of bounds is then programmed into the
VIT_SRCH_CTRL_REG_1 register.
Verified with a userspace copy of the function under AddressSanitizer:
crate = 12 (FEC_11_15) reports "stack-buffer-overflow READ of size 1
... 'coderates'".
Reject code rates beyond the table so the Viterbi search is only fed
defined values.
Fixes: 04ad28c9916d ("V4L/DVB (9017): Add support for Silicon Laboratories SI2109/2110 demodulators.")
Cc: stable@vger.kernel.org
Signed-off-by: Guo Zihao <guozh23@xiaopeng.com>
---
drivers/media/dvb-frontends/si21xx.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/media/dvb-frontends/si21xx.c b/drivers/media/dvb-frontends/si21xx.c
index e64ced2d6..67d644b7a 100644
--- a/drivers/media/dvb-frontends/si21xx.c
+++ b/drivers/media/dvb-frontends/si21xx.c
@@ -651,6 +651,9 @@ static int si21xx_setacquire(struct dvb_frontend *fe, int symbrate,
dprintk("%s\n", __func__);
status = PASS;
+ if (crate < FEC_NONE || crate > FEC_AUTO)
+ return -EINVAL;
+
coderate_ptr = coderates[crate];
si21xx_set_symbolrate(fe, symbrate);
--
2.50.1
reply other threads:[~2026-10-29 7:26 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=20261029072604.4135019-1-guozh23@xiaopeng.com \
--to=guozh23@xiaopeng.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=liplianin@me.by \
--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
all inboxes | Powered by JetHome®