All of lore.kernel.org
 help / color / mirror / Atom feed
From: Benjamin Tissoires <benjamin.tissoires@redhat.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Jiri Kosina <jikos@kernel.org>,
	"open list:HID CORE LAYER" <linux-input@vger.kernel.org>,
	Michael Zaidman <michael.zaidman@gmail.com>,
	Stefan Achatz <erazor_de@users.sourceforge.net>,
	Maxime Coquelin <mcoquelin.stm32@gmail.com>,
	Alexandre Torgue <alexandre.torgue@foss.st.com>
Subject: Re: [PATCH 2/2] HID: check for valid USB device for many HID drivers
Date: Wed, 1 Dec 2021 17:38:49 +0100	[thread overview]
Message-ID: <4c57c020-a708-aa61-8d68-23f691dffa4c@redhat.com> (raw)
In-Reply-To: <CAO-hwJ+HQxdVWA_Q3O+i7-Ur3RfeZ6VDZPJepb2Bx87Yhj1Ymw@mail.gmail.com>



On Wed, Dec 1, 2021 at 4:05 PM Benjamin Tissoires <benjamin.tissoires@redhat.com> wrote:
> > > FWIW, I am also working on a test that generates all registered USB
> > > vid/pids from the currently running kernel and will try to inject them
> > > in the testsuite. This should validate this patch and prevent future
> > > mishaps.
> >
> > That would be great to see.  Let me know if you want these broken up
> > smaller, and I will go fix the above issues.
>
> https://gitlab.freedesktop.org/bentiss/hid-tools/-/commit/2b04c6cf46c7405c8a916f324988660cb54dadea
>
> This seems sufficient to make an unpatched kernel scream :)

I have now opened https://gitlab.freedesktop.org/libevdev/hid-tools/-/merge_requests/122
with a quicker solution.

This leads apparently to 2 extra crashes:
- one in hid-holtek-kbd -> hid_is_usb() is called *after* hid_parse(), so
   report_fixup is actually called for uhid devices.
- another in bigbenff which is fixed by the following patch:

---
diff --git a/drivers/hid/hid-bigbenff.c b/drivers/hid/hid-bigbenff.c
index db6da21ade06..74ad8bf98bfd 100644
--- a/drivers/hid/hid-bigbenff.c
+++ b/drivers/hid/hid-bigbenff.c
@@ -191,7 +191,7 @@ static void bigben_worker(struct work_struct *work)
  		struct bigben_device, worker);
  	struct hid_field *report_field = bigben->report->field[0];
  
-	if (bigben->removed)
+	if (bigben->removed || !report_field)
  		return;
  
  	if (bigben->work_led) {
---

Cheers,
Benjamin


  reply	other threads:[~2021-12-01 16:38 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-01 14:15 [PATCH 1/2] HID: add hid_is_usb() function to make it simpler for USB detection Greg Kroah-Hartman
2021-12-01 14:15 ` [PATCH 2/2] HID: check for valid USB device for many HID drivers Greg Kroah-Hartman
2021-12-01 14:31   ` Benjamin Tissoires
2021-12-01 14:43     ` Greg Kroah-Hartman
2021-12-01 15:05       ` Benjamin Tissoires
2021-12-01 16:38         ` Benjamin Tissoires [this message]
2021-12-01 16:47           ` Greg Kroah-Hartman
2021-12-01 16:50             ` Greg Kroah-Hartman
2021-12-01 16:33       ` Greg Kroah-Hartman
     [not found]       ` <CAF8JNhJLB_MiHBcnYDQn6Y4w7OOZvf3O3m30bstMUspW8wn4ag@mail.gmail.com>
2021-12-03 15:53         ` Greg Kroah-Hartman

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=4c57c020-a708-aa61-8d68-23f691dffa4c@redhat.com \
    --to=benjamin.tissoires@redhat.com \
    --cc=alexandre.torgue@foss.st.com \
    --cc=erazor_de@users.sourceforge.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=jikos@kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=mcoquelin.stm32@gmail.com \
    --cc=michael.zaidman@gmail.com \
    /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.