Skip to content
Permalink
Browse files
fix slab-out-of-bounds Write in betop_probe
This patch resolves the bug 'KASAN: slab-out-of-bounds Write in betop_probe' reported by Syzbot.
This checkes hid_device's input is non empty before it's been used.

Signed-off-by: F.A. SULAIMAN <asha.16@itfac.mrt.ac.lk>
  • Loading branch information
asha1234-cyber authored and intel-lab-lkp committed Aug 16, 2021
1 parent e2e4893 commit 8fc4d7961e182bc2992bee548fa3c33b628ffadd
Showing 1 changed file with 10 additions and 0 deletions.
@@ -114,8 +114,18 @@ static int betopff_init(struct hid_device *hid)

static int betop_probe(struct hid_device *hdev, const struct hid_device_id *id)
{
struct hid_input *hidinput;
struct input_dev *dev;
int ret;

if (list_empty(&hdev->inputs)) {
hid_err(hdev, "no inputs found\n");
return -ENODEV;
}

hidinput = list_first_entry(&hdev->inputs, struct hid_input, list);
dev = hidinput->input;

if (id->driver_data)
hdev->quirks |= HID_QUIRK_MULTI_INPUT;

0 comments on commit 8fc4d79

Please sign in to comment.