mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-30 08:02:30 +00:00
media: mceusb: sanity check for prescaler value
prescaler larger than 8 would mean the carrier is at most 152Hz, which does not make sense for IR carriers. Reported-by: syzbot+6d31bf169a8265204b8d@syzkaller.appspotmail.com Signed-off-by: Sean Young <sean@mess.org> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
This commit is contained in:
parent
a6f42f5ebb
commit
9dec0f48a7
1 changed files with 8 additions and 1 deletions
|
@ -701,11 +701,18 @@ static void mceusb_dev_printdata(struct mceusb_dev *ir, u8 *buf, int buf_len,
|
|||
data[0], data[1]);
|
||||
break;
|
||||
case MCE_RSP_EQIRCFS:
|
||||
if (!data[0] && !data[1]) {
|
||||
dev_dbg(dev, "%s: no carrier", inout);
|
||||
break;
|
||||
}
|
||||
// prescaler should make sense
|
||||
if (data[0] > 8)
|
||||
break;
|
||||
period = DIV_ROUND_CLOSEST((1U << data[0] * 2) *
|
||||
(data[1] + 1), 10);
|
||||
if (!period)
|
||||
break;
|
||||
carrier = (1000 * 1000) / period;
|
||||
carrier = USEC_PER_SEC / period;
|
||||
dev_dbg(dev, "%s carrier of %u Hz (period %uus)",
|
||||
inout, carrier, period);
|
||||
break;
|
||||
|
|
Loading…
Reference in a new issue