From: Pavel Skripkin <paskripkin@gmail.com>
To: "F.A.Sulaiman" <asha.16@itfac.mrt.ac.lk>,
jikos@kernel.org, benjamin.tissoires@redhat.com
Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] HID: betop: fix slab-out-of-bounds Write in betop_probe
Date: Sun, 22 Aug 2021 19:01:36 +0300 [thread overview]
Message-ID: <a4ada71d-4827-a6d7-6488-486cae76c257@gmail.com> (raw)
In-Reply-To: <20210822134319.3738-1-asha.16@itfac.mrt.ac.lk>
On 8/22/21 4:43 PM, F.A.Sulaiman wrote:
> Syzbot reported slab-out-of-bounds Write bug in hid-betopff driver.
> The problem is the driver assumes the device must have an input report but
> some malicious devices violate this assumption.
>
> So this patch checks hid_device's input is non empty before it's been used.
>
> Reported-by: syzbot+07efed3bc5a1407bd742@syzkaller.appspotmail.com
> Signed-off-by: F.A. SULAIMAN <asha.16@itfac.mrt.ac.lk>
> ---
> drivers/hid/hid-betopff.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/drivers/hid/hid-betopff.c b/drivers/hid/hid-betopff.c
> index 0790fbd3fc9a..2d62bde21413 100644
> --- a/drivers/hid/hid-betopff.c
> +++ b/drivers/hid/hid-betopff.c
> @@ -116,6 +116,11 @@ static int betop_probe(struct hid_device *hdev, const struct hid_device_id *id)
> {
> int ret;
>
> + if (list_empty(&hdev->inputs)) {
> + hid_err(hdev, "no inputs found\n");
> + return -ENODEV;
> + }
> +
> if (id->driver_data)
> hdev->quirks |= HID_QUIRK_MULTI_INPUT;
>
>
I am still able to trigger reported slab-out-bound with this patch
applied, please move this sanity check inside betopff_init().
Jiri, does it make sense to add proper error handling of betopff_init()?
Nowadays betop_probe() just ignores betopff_init() return value. It
looks wrong to me.
I think, Asha can prepare a patch series with these 2 changes
With regards,
Pavel Skripkin
next prev parent reply other threads:[~2021-08-22 16:01 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-16 20:15 [PATCH] fix slab-out-of-bounds Write in betop_probe F.A.Sulaiman
2021-08-17 0:05 ` kernel test robot
2021-08-17 0:05 ` kernel test robot
2021-08-17 0:35 ` kernel test robot
2021-08-17 0:35 ` kernel test robot
2021-08-17 20:58 ` kernel test robot
2021-08-17 20:58 ` kernel test robot
2021-08-19 18:47 ` Jiri Kosina
2021-08-22 13:43 ` [PATCH v2] HID: betop: " F.A.Sulaiman
2021-08-22 16:01 ` Pavel Skripkin [this message]
2021-08-24 15:07 ` [PATCH v3] " F.A.Sulaiman
2021-08-24 15:12 ` Pavel Skripkin
2021-09-15 14:31 ` Jiri Kosina
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=a4ada71d-4827-a6d7-6488-486cae76c257@gmail.com \
--to=paskripkin@gmail.com \
--cc=asha.16@itfac.mrt.ac.lk \
--cc=benjamin.tissoires@redhat.com \
--cc=jikos@kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.