summaryrefslogtreecommitdiff
path: root/drivers/media
diff options
context:
space:
mode:
authorJames Reynolds <jr@memlen.com>2020-12-22 15:07:04 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-03-04 12:26:41 +0300
commit32a82e001ead372f9909af058b98e3da102bc50a (patch)
tree2b1f71a019ddff852dcd8cb85b8542b3fc1c82bb /drivers/media
parent8812bed7ec749060623bd395c399834e23beb106 (diff)
downloadlinux-32a82e001ead372f9909af058b98e3da102bc50a.tar.xz
media: mceusb: Fix potential out-of-bounds shift
commit 1b43bad31fb0e00f45baf5b05bd21eb8d8ce7f58 upstream. When processing a MCE_RSP_GETPORTSTATUS command, the bit index to set in ir->txports_cabled comes from response data, and isn't validated. As ir->txports_cabled is a u8, nothing should be done if the bit index is greater than 7. Cc: stable@vger.kernel.org Reported-by: syzbot+ec3b3128c576e109171d@syzkaller.appspotmail.com Signed-off-by: James Reynolds <jr@memlen.com> Signed-off-by: Sean Young <sean@mess.org> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/rc/mceusb.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/media/rc/mceusb.c b/drivers/media/rc/mceusb.c
index f9616158bcf4..867f5fb6fbe1 100644
--- a/drivers/media/rc/mceusb.c
+++ b/drivers/media/rc/mceusb.c
@@ -1169,7 +1169,7 @@ static void mceusb_handle_command(struct mceusb_dev *ir, u8 *buf_in)
switch (subcmd) {
/* the one and only 5-byte return value command */
case MCE_RSP_GETPORTSTATUS:
- if (buf_in[5] == 0)
+ if (buf_in[5] == 0 && *hi < 8)
ir->txports_cabled |= 1 << *hi;
break;