[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <201012042122.23852.oliver@neukum.org>
Date: Sat, 4 Dec 2010 21:22:23 +0100
From: Oliver Neukum <oliver@...kum.org>
To: Dmitry Torokhov <dmitry.torokhov@...il.com>
Cc: Valentine Barshak <vbarshak@...sta.com>,
Jiri Kosina <jkosina@...e.cz>, linux-usb@...r.kernel.org,
linux-input@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] USB: USBHID: Fix race between disconnect and hiddev_ioctl
Am Samstag, 4. Dezember 2010, 00:16:12 schrieb Dmitry Torokhov:
> > Since disconnect can happen at any time, we can't initialize
> > struct hid_device *hid = hiddev->hid at the beginning of ioctl
> > and then use it.
> >
> > This change checks hiddev->exist flag while holding
> > the existancelock and uses hid_device only if it exists.
>
> Why didn't you take the lock and check hiddev->exist at the beginning of
> ioctl handler instead of pushing it down into individual command
> handlers? I guess it would slow down HIDIOCGVERSION but I think we could
> pay this price for code that is more clear ;)
Strictly speaking you'd change the semantics. Right now you can execute
the ioctl even if you know you are holding an fd to a disconnected device
open.
Regards
Oliver
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists