Re: [PATCH v2] HID: leave dev_rdesc unmodified and use it for comparisons

2012-09-19 Thread Henrik Rydberg
Hi Kevin, Thanks for looking to this. > Hmm. I hadn't noticed that the other drivers are returning a static > structure. In that case, it seems that report_fixup itself is broken > from a memory perspective, in that it returns pointers to > inconsistent storage types depending on the driver. The

Re: [PATCH v2] HID: leave dev_rdesc unmodified and use it for comparisons

2012-09-19 Thread Kevin Daughtridge
On 09/19/12 01:05 N.U., Jiri Slaby wrote: AFAICS this is incorrect. Some drivers return pointers to their own static structure from their .report_fixup. Hence there are two problems: * leak, because kmemdup'ped start is never freed * invalid free -- kfree(device->rdesc) will try to free a static

Re: [PATCH v2] HID: leave dev_rdesc unmodified and use it for comparisons

2012-09-19 Thread Jiri Kosina
On Tue, 18 Sep 2012, Kevin Daughtridge wrote: > The dev_rdesc member of the hid_device structure is meant to store the > original > report descriptor received from the device, but it is currently passed to any > report_fixup method before it is copied to the rdesc member. This patch moves > the km

Re: [PATCH v2] HID: leave dev_rdesc unmodified and use it for comparisons

2012-09-19 Thread Sergei Shtylyov
Hello. On 19-09-2012 6:36, Kevin Daughtridge wrote: The dev_rdesc member of the hid_device structure is meant to store the original report descriptor received from the device, but it is currently passed to any report_fixup method before it is copied to the rdesc member. This patch moves the kme

Re: [PATCH v2] HID: leave dev_rdesc unmodified and use it for comparisons

2012-09-19 Thread Jiri Slaby
On 09/19/2012 04:36 AM, Kevin Daughtridge wrote: > --- a/drivers/hid/hid-core.c > +++ b/drivers/hid/hid-core.c > @@ -775,12 +775,14 @@ int hid_open_report(struct hid_device *d > return -ENODEV; > size = device->dev_rsize; > > +start = kmemdup(start, size, GFP_KERNEL); > +if

[PATCH v2] HID: leave dev_rdesc unmodified and use it for comparisons

2012-09-18 Thread Kevin Daughtridge
The dev_rdesc member of the hid_device structure is meant to store the original report descriptor received from the device, but it is currently passed to any report_fixup method before it is copied to the rdesc member. This patch moves the kmemdup to before, not after, the report_fixup call, keepi