mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Bruno Prémont" <bonbons@linux-vserver.org>
To: 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>
Cc: 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: Mon, 8 Feb 2010 19:06:49 +0100	[thread overview]
Message-ID: <20100208190649.0ceea556@neptune.home> (raw)
In-Reply-To: <20100208175145.606ca761@neptune.home>

On Mon, 08 February 2010 Bruno Prémont <bonbons@linux-vserver.org> wrote:
> 2.6.33-rc7 (don't know if any previous version resumes properly)
> crashes during resume from S2Ram when my USB keyboard is connected but
> resumes properly (viafb corruption put apart) when the USB keyboard is
> not connected.

The patch below works around the crash though the WARN_ON() in
usbhid_restart_out_queue() triggers in place.

Bruno

diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c
index e2997a8..d2f8eef 100644
--- a/drivers/hid/usbhid/hid-core.c
+++ b/drivers/hid/usbhid/hid-core.c
@@ -196,7 +196,7 @@ static void usbhid_mark_busy(struct usbhid_device *usbhid)
 
 static int usbhid_restart_out_queue(struct usbhid_device *usbhid)
 {
-	struct hid_device *hid = usb_get_intfdata(usbhid->intf);
+	struct hid_device *hid = usbhid->intf ? usb_get_intfdata(usbhid->intf) : NULL;
 	int kicked;
 
 	if (!hid)
@@ -214,7 +214,7 @@ static int usbhid_restart_out_queue(struct usbhid_device *usbhid)
 
 static int usbhid_restart_ctrl_queue(struct usbhid_device *usbhid)
 {
-	struct hid_device *hid = usb_get_intfdata(usbhid->intf);
+	struct hid_device *hid = usbhid->intf ? usb_get_intfdata(usbhid->intf) : NULL;
 	int kicked;
 
 	WARN_ON(hid == NULL);

  reply	other threads:[~2010-02-08 18:07 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 [this message]
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
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=20100208190649.0ceea556@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 \
    /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®