On Wed, Sep 27, 2017 at 4:19 PM, Aaron Armstrong Skomra
<sko...@gmail.com> wrote:
>
>
> On Fri, Aug 11, 2017 at 4:46 PM, Ping Cheng <pingli...@gmail.com> wrote:
>>
>> On Friday, August 11, 2017, Jason Gerecke <killert...@gmail.com> wrote:
>>>
>>> The USB protocol allows devices to have multiple "configurations" that
>>> the OS can switch between. A an "unconfigured" state is also possible,
>>> especially when the device is first connected. If '__wacom_is_usb_parent'
>>> comes across an unconfigured USB device, the 'config' variable will
>>> be NULL. We need to add a check for this state before attempting a
>>> dereference.
>>>
>>> Fixes: 38c795d ("backport: HID: wacom: Improve generic name generation")
>>> Fixes: bb55947 ("HID: wacom: Improve generic name generation")
>>> Signed-off-by: Jason Gerecke <jason.gere...@wacom.com>
>>
>>
> This patch doesn't need to go upstream?

It is only for kernels older than 4.14. See the following line at the
start of the block:

#if LINUX_VERSION_CODE < KERNEL_VERSION(4,14,0)

Cheers,
Ping

>
> Best,
> Aaron
>>
>> The patch makes sense to me. It is
>>
>> Reviewed-by: Ping Cheng <ping.ch...@wavom.com>
>>
>> Cheers,
>> Ping
>>
>>> ---
>>> Changes from v1:
>>>   * Apply fix to 3.17 tree
>>>   * Add proper "Fixes" annotations
>>>
>>>  3.17/wacom_sys.c | 2 +-
>>>  4.5/wacom_sys.c  | 2 +-
>>>  2 files changed, 2 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/3.17/wacom_sys.c b/3.17/wacom_sys.c
>>> index 9fccf59..2996d0d 100644
>>> --- a/3.17/wacom_sys.c
>>> +++ b/3.17/wacom_sys.c
>>> @@ -29,7 +29,7 @@ static int __wacom_is_usb_parent(struct usb_device
>>> *usbdev, void *ptr)
>>>         struct usb_host_config *config = usbdev->actconfig;
>>>         int i;
>>>
>>> -       for (i = 0; i < config->desc.bNumInterfaces; i++) {
>>> +       for (i = 0; config && i < config->desc.bNumInterfaces; i++) {
>>>                 if (&config->interface[i]->dev == parent)
>>>                         return 1;
>>>         }
>>> diff --git a/4.5/wacom_sys.c b/4.5/wacom_sys.c
>>> index cfe5fa8..3a65174 100644
>>> --- a/4.5/wacom_sys.c
>>> +++ b/4.5/wacom_sys.c
>>> @@ -30,7 +30,7 @@ static int __wacom_is_usb_parent(struct usb_device
>>> *usbdev, void *ptr)
>>>         struct usb_host_config *config = usbdev->actconfig;
>>>         int i;
>>>
>>> -       for (i = 0; i < config->desc.bNumInterfaces; i++) {
>>> +       for (i = 0; config && i < config->desc.bNumInterfaces; i++) {
>>>                 if (&config->interface[i]->dev == parent)
>>>                         return 1;
>>>         }
>>> --
>>> 2.13.4
>>>
>

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel

Reply via email to