From: Jiri Kosina <jikos@kernel.org>
To: Andrej Shadura <andrew.shadura@collabora.co.uk>
Cc: Benjamin Tissoires <benjamin.tissoires@gmail.com>,
linux-input <linux-input@vger.kernel.org>,
linux-usb@vger.kernel.org,
Andrzej Pietrasiewicz <andrzej.p@collabora.com>,
kernel@collabora.com, linux-crypto@vger.kernel.org
Subject: Re: [PATCH v3] HID: add driver for U2F Zero built-in LED and RNG
Date: Wed, 17 Apr 2019 16:43:17 +0200 (CEST) [thread overview]
Message-ID: <nycvar.YFH.7.76.1904171642020.9803@cbobk.fhfr.pm> (raw)
Message-ID: <20190417144317.BsD7Mq6qEBCPaTxGmr2QVTCnUuCP74wdPDp1FOF_CTU@z> (raw)
In-Reply-To: <d33b8772-bae6-1d20-8ff0-3397095f6e4b@collabora.co.uk>
On Thu, 11 Apr 2019, Andrej Shadura wrote:
> >>> So I still am not really happy about this being wired up into generic HID
> >>> although it's really a USB driver, but we've discussed that already, and I
> >>> don't see any option that'd work substantially better in this case,
> >>> especially from the UX point of view. Oh well. Applied to for-5.2/u2fzero,
> >>> thanks!
> >>>
> >>
> >> Hi wish I were CC-ed on these threads.
> >
> > Gah, for some reason I was convinced you were.
> >
> >> My CI script now fails because hid-u2fzero.ko needs devm_hwrng_register
> >> and the Kconfig doesn't force pulling the right dependency.
>
> >> Also, you probably want to add in .probe() a check for the actual
> >> transport driver (`hid_is_using_ll_driver(hdev, &usb_hid_driver)`) or
> >> you can not use the usbhid functions without crashing the kernel.
>
> Thanks, that’s very useful.
>
> > Benjamin, I love your CI :)
> >
> > Andrej, could you please send fixups on top of the applied patch?
>
> Sure, will do.
I didn't receive any followup; the Kconfig dependency has already been
fixed by Mao Wenan, and I've just queued the patch below on top of that as
well.
From: Jiri Kosina <jkosina@suse.cz>
Subject: [PATCH] HID: u2fzero: fail probe if not using USB transport
u2fzero driver is USB-only. Therefore we have to give up in ->probe()
callback in case we're called with non-USB transport driver bound,
otherwise the kernel will crash trying to use USBHID API on a non-USB
transport.
Fixes: 42337b9d4d958("HID: add driver for U2F Zero built-in LED and RNG")
Reported-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
---
drivers/hid/hid-u2fzero.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/hid/hid-u2fzero.c b/drivers/hid/hid-u2fzero.c
index d11a5cb56a0d..95e0807878c7 100644
--- a/drivers/hid/hid-u2fzero.c
+++ b/drivers/hid/hid-u2fzero.c
@@ -286,6 +286,9 @@ static int u2fzero_probe(struct hid_device *hdev,
unsigned int minor;
int ret;
+ if (!hid_is_using_ll_driver(hdev, &usb_hid_driver))
+ return -EINVAL;
+
dev = devm_kzalloc(&hdev->dev, sizeof(*dev), GFP_KERNEL);
if (dev == NULL)
return -ENOMEM;
--
Jiri Kosina
SUSE Labs
next prev parent reply other threads:[~2019-04-17 14:43 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-01 12:42 [v3] HID: add driver for U2F Zero built-in LED and RNG Andrej Shadura
2019-04-10 12:02 ` Jiri Kosina
2019-04-10 12:02 ` [PATCH v3] " Jiri Kosina
2019-04-11 9:58 ` [v3] " Benjamin Tissoires
2019-04-11 9:58 ` [PATCH v3] " Benjamin Tissoires
2019-04-11 10:35 ` [v3] " Jiri Kosina
2019-04-11 10:35 ` [PATCH v3] " Jiri Kosina
2019-04-11 11:52 ` [v3] " Andrej Shadura
2019-04-11 11:52 ` [PATCH v3] " Andrej Shadura
2019-04-17 14:43 ` Jiri Kosina [this message]
2019-04-17 14:43 ` Jiri Kosina
2019-04-17 14:47 ` [v3] " Andrej Shadura
2019-04-17 14:47 ` [PATCH v3] " Andrej Shadura
2019-10-03 7:19 ` Andrej Shadura
2019-10-03 15:25 ` Alan Stern
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=nycvar.YFH.7.76.1904171642020.9803@cbobk.fhfr.pm \
--to=jikos@kernel.org \
--cc=andrew.shadura@collabora.co.uk \
--cc=andrzej.p@collabora.com \
--cc=benjamin.tissoires@gmail.com \
--cc=kernel@collabora.com \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-usb@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).