lkml.org 
[lkml]   [2009]   [Jan]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [GIT] HID updates for 2.6.29
Jiri Kosina wrote:

> On Wed, 7 Jan 2009, Oliver Neukum wrote:
>
>>> --- a/drivers/hid/usbhid/hiddev.c
>>> +++ b/drivers/hid/usbhid/hiddev.c
>>> @@ -885,6 +885,7 @@ int hiddev_connect(struct hid_device *hid, unsigned int force)
>>> } else {
>>> hid->minor = usbhid->intf->minor;
>>> hiddev_table[usbhid->intf->minor - HIDDEV_MINOR_BASE] = hiddev;
>>> + hid->hiddev = hiddev;
>> It seems to me that this is still a race condition. What prevents open()
>> from being called before this is set?
>
> Right, there indeed is a tiny race window. Gabriel, could you please
> verify with the patch below instead? Thanks.


Your patch fixed the panic for me.

Feel free to add my Tested-by: if needed.

>
>
> From: Jiri Kosina <jkosina@suse.cz>
> Subject: [PATCH] HID: fix hid->hiddev initialization in hiddev_connect()
>
> Commit 079034073fa ("HID: hiddev cleanup -- handle all error conditions
> properly") by mistake removed proper initialization of hid->hiddev pointer
> in hiddev_connect() in case usb_register_dev() succeeds for the hiddev node.
> Put it properly back in place.
>
> Reported-by: Gabriel C <nix.or.die@googlemail.com>
> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
> ---
> drivers/hid/usbhid/hiddev.c | 2 ++
> 1 files changed, 2 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/hid/usbhid/hiddev.c b/drivers/hid/usbhid/hiddev.c
> index 6a98f9f..d73eea3 100644
> --- a/drivers/hid/usbhid/hiddev.c
> +++ b/drivers/hid/usbhid/hiddev.c
> @@ -874,12 +874,14 @@ int hiddev_connect(struct hid_device *hid, unsigned int force)
> INIT_LIST_HEAD(&hiddev->list);
> spin_lock_init(&hiddev->list_lock);
> mutex_init(&hiddev->existancelock);
> + hid->hiddev = hiddev;
> hiddev->hid = hid;
> hiddev->exist = 1;
>
> retval = usb_register_dev(usbhid->intf, &hiddev_class);
> if (retval) {
> err_hid("Not able to get a minor for this device.");
> + hid->hiddev = NULL;
> kfree(hiddev);
> return -1;
> } else {


Regards,

Gabriel C


\
 
 \ /
  Last update: 2009-01-07 14:29    [from the cache]
©2003-2011 Jasper Spaans