From: trapDoor <trapdoor6@gmail.com>
To: Jiri Kosina <jkosina@suse.cz>
Cc: osnix0@googlemail.com, andrea.gelmini@gelma.net,
"Rafael J. Wysocki" <rjw@sisk.pl>,
LKML <linux-kernel@vger.kernel.org>,
arnd@arndb.de, trapDoor <trapdoor6@googlemail.com>
Subject: Re: [REGRESSION, bisected] 2.6.36-rc1 - suspend issues
Date: Wed, 18 Aug 2010 10:13:35 +0100 [thread overview]
Message-ID: <AANLkTikPC1CGjNcP2ARf8SJw3HTEBOcdgGnDjx87DERX@mail.gmail.com> (raw)
In-Reply-To: <alpine.LNX.2.00.1008181045110.1019@pobox.suse.cz>
On Wed, Aug 18, 2010 at 9:46 AM, Jiri Kosina <jkosina@suse.cz> wrote:
> On Wed, 18 Aug 2010, trapDoor wrote:
>
>> > Could you please verify whether the patch below (which is currently queued
>> > in my tree and I am planning to push it to Linus soon, as it fixes memory
>> > corruption) fixes your issue? Thanks.
>> >
>> > commit 9c9e54a8df0be48aa359744f412377cc55c3b7d2
>> > Author: Jiri Kosina <jkosina@suse.cz>
>> > Date: Fri Aug 13 12:19:45 2010 +0200
>> >
>> > HID: hiddev: fix memory corruption due to invalid intfdata
>> >
>> > Commit bd25f4dd6972755579d0 ("HID: hiddev: use usb_find_interface,
>> > get rid of BKL") introduced using of private intfdata in hiddev for
>> > purpose of storing hiddev pointer.
>> >
>> > This is a problem, because intf pointer is already being set to struct
>> > hid_device pointer by HID core. This obviously lead to memory corruptions
>> > at device disconnect time, such as
>> >
>> > WARNING: at lib/kobject.c:595 kobject_put+0x37/0x4b()
>> > kobject: '(null)' (ffff88011e9cd898): is not initialized, yet kobject_put() is being called.
>> >
>> > Convert hiddev into accessing hiddev through struct hid_device which is
>> > in intfdata already.
>> >
>> > Reported-and-tested-by: Markus Trippelsdorf <markus@trippelsdorf.de>
>> > Reported-and-tested-by: Heinz Diehl <htd@fritha.org>
>> > Reported-and-tested-by: Alan Ott <alan@signal11.us>
>> > Signed-off-by: Jiri Kosina <jkosina@suse.cz>
>> >
>> > diff --git a/drivers/hid/usbhid/hiddev.c b/drivers/hid/usbhid/hiddev.c
>> > index f285017..0a29c51 100644
>> > --- a/drivers/hid/usbhid/hiddev.c
>> > +++ b/drivers/hid/usbhid/hiddev.c
>> > @@ -266,13 +266,15 @@ static int hiddev_open(struct inode *inode, struct file *file)
>> > {
>> > struct hiddev_list *list;
>> > struct usb_interface *intf;
>> > + struct hid_device *hid;
>> > struct hiddev *hiddev;
>> > int res;
>> >
>> > intf = usb_find_interface(&hiddev_driver, iminor(inode));
>> > if (!intf)
>> > return -ENODEV;
>> > - hiddev = usb_get_intfdata(intf);
>> > + hid = usb_get_intfdata(intf);
>> > + hiddev = hid->hiddev;
>> >
>> > if (!(list = kzalloc(sizeof(struct hiddev_list), GFP_KERNEL)))
>> > return -ENOMEM;
>> > @@ -890,7 +892,6 @@ int hiddev_connect(struct hid_device *hid, unsigned int force)
>> > hid->hiddev = hiddev;
>> > hiddev->hid = hid;
>> > hiddev->exist = 1;
>> > - usb_set_intfdata(usbhid->intf, usbhid);
>> > retval = usb_register_dev(usbhid->intf, &hiddev_class);
>> > if (retval) {
>> > err_hid("Not able to get a minor for this device.");
>> >
>>
>> Yes. That patch fixes my problem too. Tested on top of the current
>> tree [2.6.36-rc1-00051-g3b89f56]. Thanks!
>
> Thanks a lot for prompt testing.
>
>> One little thing though. There is a message about 2 lines offset when
>> patching. Succeeded anyway but I've never got such messages before so
>> I thought it would be better to mention it:
>>
>> patch -p1 <../patches/hid.git-9c9e54a8df0be48aa359744f412377cc55c3b7d2.patch
>> patching file drivers/hid/usbhid/hiddev.c
>> Hunk #2 succeeded at 890 (offset -2 lines).
>>
>> I downloaded the patch from
>> http://git.kernel.org/?p=linux/kernel/git/jikos/hid.git;a=commitdiff;h=9c9e54a8df0be48aa359744f412377cc55c3b7d2
>> to make sure I had the original indentations etc. preserved (Gmail
>> tends to mess up with lines).
>
> Yeah, that's fine. It just means that the patch has been generated on a
> slightly different version of the file, which makes the line numbers be
> off a bit, but patch, git and friends can cope with this easily.
>
Thanks for confirming.
Andrea, Gabriel
Would you please check if Jiri's patch solves the problem on your end
as well? Just to make 100% sure we can close related bugzilla call.
--
Regards
Tomasz B.
next prev parent reply other threads:[~2010-08-18 9:13 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-17 17:01 trapDoor
2010-08-17 19:27 ` trapDoor
2010-08-17 20:54 ` Andrea Gelmini
2010-08-17 21:48 ` trapDoor
2010-08-18 1:25 ` Rafael J. Wysocki
2010-08-18 1:56 ` trapDoor
2010-08-18 7:13 ` Jiri Kosina
2010-08-18 8:43 ` trapDoor
2010-08-18 8:46 ` Jiri Kosina
2010-08-18 9:13 ` trapDoor [this message]
2010-08-18 9:33 ` Andrea Gelmini
2010-08-18 13:30 ` Andrea Gelmini
2010-08-18 14:48 ` Gabriel Craciunescu
2010-08-19 7:40 ` Jiri Kosina
2010-08-19 19:23 ` trapDoor
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=AANLkTikPC1CGjNcP2ARf8SJw3HTEBOcdgGnDjx87DERX@mail.gmail.com \
--to=trapdoor6@gmail.com \
--cc=andrea.gelmini@gelma.net \
--cc=arnd@arndb.de \
--cc=jkosina@suse.cz \
--cc=linux-kernel@vger.kernel.org \
--cc=osnix0@googlemail.com \
--cc=rjw@sisk.pl \
--cc=trapdoor6@googlemail.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 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®