From: "Bruno Prémont" <bonbons@linux-vserver.org>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: Jiri Kosina <jkosina@suse.cz>, Oliver Neukum <oliver@neukum.org>,
Stephen Rothwell <sfr@canb.auug.org.au>,
Marcel Holtmann <marcel@holtmann.org>,
H Hartley Sweeten <hsweeten@visionengravers.com>,
<linux-usb@vger.kernel.org>, <linux-input@vger.kernel.org>,
<linux-kernel@vger.kernel.org>
Subject: Re: S2R resume crash in 2.6.33-rc7 - NULL pointer dereference in dev_get_drvdata() for usbhid
Date: Sat, 13 Feb 2010 19:36:09 +0100 [thread overview]
Message-ID: <20100213193609.3337b3f0@neptune.home> (raw)
In-Reply-To: <Pine.LNX.4.44L0.1002131238580.23844-100000@netrider.rowland.org>
On Sat, 13 February 2010 Alan Stern <stern@rowland.harvard.edu> wrote:
>
> On Sat, 13 Feb 2010, Bruno [UTF-8] Prémont wrote:
>
> > On Mon, 08 February 2010 Alan Stern <stern@rowland.harvard.edu>
> > wrote:
> > > Clearly something is setting usbhid->intf to NULL. But I don't
> > > see any code that would do it. You may have to resort to putting
> > > printk() statements at various strategic places to find out where
> > > it happens. You could start with the beginnings and ends of
> > > hid_suspend, hid_resume, and hid_reset_resume. Maybe also
> > > usbhid_disconnect(), just in case.
> >
> > I did add a few printk()s and WARN_ON()s to get a better idea of
> > why/when usbhid->intf is NULL and it is already since probe time of
> > the second interface anounced by the USB keyboard (hid.debug=1):
>
> ...
>
> > This lets me guess that hid_add_device() is doing something wrong
> > here when report parsing fails... (as that one is the only one which
> > could be doing the initialization of usbhid which does work for the
> > first interface announced by my keyboard)
>
> I don't know about doing anything wrong... However it does appear
> that in this case the interface is registered on the HID bus but
> doesn't get bound to a driver. Jiri will know whether or not that's
> the desired outcome.
>
> On the other hand, I don't think there would be anything wrong with
> moving the
>
> usbhid->intf = intf;
> usbhid->ifnum = interface->desc.bInterfaceNumber;
>
> lines from usbhid_start() to usbhid_probe(), just before the call to
> hid_add_device(). It should fix the bug, and those lines do belong in
> the probe routine. Jiri, any problems with doing this?
With the below patch (which is only half of the move work) I don't
get crashes anymore. Though I wonder if other initialization steps
(like the spin_lock_init() right before setting usbhid->intf) would
need to be moved as well.
Bruno
diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c
index e2997a8..690ca75 100644
--- a/drivers/hid/usbhid/hid-core.c
+++ b/drivers/hid/usbhid/hid-core.c
@@ -1154,6 +1154,8 @@ static int usbhid_probe(struct usb_interface *intf, const struct usb_device_id *
hid->driver_data = usbhid;
usbhid->hid = hid;
+ usbhid->intf = intf;
+ usbhid->ifnum = interface->desc.bInterfaceNumber;
ret = hid_add_device(hid);
if (ret) {
next prev parent reply other threads:[~2010-02-13 18:36 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-08 16:51 Bruno Prémont
2010-02-08 18:06 ` Bruno Prémont
2010-02-08 20:25 ` Alan Stern
2010-02-13 12:57 ` Bruno Prémont
2010-02-13 17:46 ` Alan Stern
2010-02-13 18:36 ` Bruno Prémont [this message]
2010-02-17 13:24 ` Jiri Kosina
2010-02-08 18:16 ` Alan Stern
2010-02-08 18:47 ` Bruno Prémont
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=20100213193609.3337b3f0@neptune.home \
--to=bonbons@linux-vserver.org \
--cc=hsweeten@visionengravers.com \
--cc=jkosina@suse.cz \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=marcel@holtmann.org \
--cc=oliver@neukum.org \
--cc=sfr@canb.auug.org.au \
--cc=stern@rowland.harvard.edu \
/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
all inboxes | Powered by JetHome®