Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid
authorLinus Torvalds <torvalds@linux-foundation.org>
Fri, 28 Jun 2019 00:39:18 +0000 (08:39 +0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 28 Jun 2019 00:39:18 +0000 (08:39 +0800)
Pull HID fixes from Jiri Kosina:

 - fix for one corner case in HID++ protocol with respect to handling
   very long reports, from Hans de Goede

 - power management fix in Intel-ISH driver, from Hyungwoo Yang

 - use-after-free fix in Intel-ISH driver, from Dan Carpenter

 - a couple of new device IDs/quirks from Kai-Heng Feng, Kyle Godbey and
   Oleksandr Natalenko

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid:
  HID: intel-ish-hid: fix wrong driver_data usage
  HID: multitouch: Add pointstick support for ALPS Touchpad
  HID: logitech-dj: Fix forwarding of very long HID++ reports
  HID: uclogic: Add support for Huion HS64 tablet
  HID: chicony: add another quirk for PixArt mouse
  HID: intel-ish-hid: Fix a use after free in load_fw_from_host()

1  2 
drivers/hid/hid-ids.h
drivers/hid/hid-logitech-dj.c
drivers/hid/hid-multitouch.c
drivers/hid/hid-quirks.c
drivers/hid/intel-ish-hid/ishtp-hid-client.c
drivers/hid/intel-ish-hid/ishtp/bus.c

diff --combined drivers/hid/hid-ids.h
@@@ -1,4 -1,3 +1,4 @@@
 +/* SPDX-License-Identifier: GPL-2.0-or-later */
  /*
   *  USB HID quirks support for Linux
   *
@@@ -9,6 -8,10 +9,6 @@@
   */
  
  /*
 - * This program is free software; you can redistribute it and/or modify it
 - * under the terms of the GNU General Public License as published by the Free
 - * Software Foundation; either version 2 of the License, or (at your option)
 - * any later version.
   */
  
  #ifndef HID_IDS_H_FILE
@@@ -80,6 -83,7 +80,7 @@@
  #define HID_DEVICE_ID_ALPS_U1_DUAL_3BTN_PTP   0x1220
  #define HID_DEVICE_ID_ALPS_U1         0x1215
  #define HID_DEVICE_ID_ALPS_T4_BTNLESS 0x120C
+ #define HID_DEVICE_ID_ALPS_1222               0x1222
  
  
  #define USB_VENDOR_ID_AMI             0x046b
  #define USB_DEVICE_ID_CHICONY_MULTI_TOUCH     0xb19d
  #define USB_DEVICE_ID_CHICONY_WIRELESS        0x0618
  #define USB_DEVICE_ID_CHICONY_PIXART_USB_OPTICAL_MOUSE        0x1053
+ #define USB_DEVICE_ID_CHICONY_PIXART_USB_OPTICAL_MOUSE2       0x0939
  #define USB_DEVICE_ID_CHICONY_WIRELESS2       0x1123
  #define USB_DEVICE_ID_ASUS_AK1D               0x1125
  #define USB_DEVICE_ID_CHICONY_TOSHIBA_WT10A   0x1408
  
  #define USB_VENDOR_ID_HUION           0x256c
  #define USB_DEVICE_ID_HUION_TABLET    0x006e
+ #define USB_DEVICE_ID_HUION_HS64      0x006d
  
  #define USB_VENDOR_ID_IBM                                     0x04b3
  #define USB_DEVICE_ID_IBM_SCROLLPOINT_III                     0x3100
@@@ -1,10 -1,25 +1,10 @@@
 +// SPDX-License-Identifier: GPL-2.0-only
  /*
   *  HID driver for Logitech Unifying receivers
   *
   *  Copyright (c) 2011 Logitech
   */
  
 -/*
 - * This program is free software; you can redistribute it and/or modify
 - * it under the terms of the GNU General Public License version 2 as
 - * published by the Free Software Foundation.
 -
 - *
 - * This program is distributed in the hope that it will be useful,
 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 - * GNU General Public License for more details.
 - *
 - * You should have received a copy of the GNU General Public License
 - * along with this program; if not, write to the Free Software
 - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 - *
 - */
  
  
  #include <linux/device.h>
@@@ -30,6 -45,7 +30,7 @@@
  
  #define REPORT_ID_HIDPP_SHORT                 0x10
  #define REPORT_ID_HIDPP_LONG                  0x11
+ #define REPORT_ID_HIDPP_VERY_LONG             0x12
  
  #define HIDPP_REPORT_SHORT_LENGTH             7
  #define HIDPP_REPORT_LONG_LENGTH              20
@@@ -1242,7 -1258,8 +1243,8 @@@ static int logi_dj_ll_raw_request(struc
        int ret;
  
        if ((buf[0] == REPORT_ID_HIDPP_SHORT) ||
-           (buf[0] == REPORT_ID_HIDPP_LONG)) {
+           (buf[0] == REPORT_ID_HIDPP_LONG) ||
+           (buf[0] == REPORT_ID_HIDPP_VERY_LONG)) {
                if (count < 2)
                        return -EINVAL;
  
@@@ -1,4 -1,3 +1,4 @@@
 +// SPDX-License-Identifier: GPL-2.0-or-later
  /*
   *  HID driver for multitouch panels
   *
   *  Copyright (c) 2009-2010 Stephane Chatty <chatty@enac.fr>
   *  Copyright (c) 2010      Henrik Rydberg <rydberg@euromail.se>
   *  Copyright (c) 2010      Canonical, Ltd.
 - *
   */
  
  /*
 - * This program is free software; you can redistribute it and/or modify it
 - * under the terms of the GNU General Public License as published by the Free
 - * Software Foundation; either version 2 of the License, or (at your option)
 - * any later version.
   */
  
  /*
@@@ -1776,6 -1780,10 +1776,10 @@@ static const struct hid_device_id mt_de
                HID_DEVICE(BUS_I2C, HID_GROUP_MULTITOUCH_WIN_8,
                        USB_VENDOR_ID_ALPS_JP,
                        HID_DEVICE_ID_ALPS_U1_DUAL_3BTN_PTP) },
+       { .driver_data = MT_CLS_WIN_8_DUAL,
+               HID_DEVICE(BUS_I2C, HID_GROUP_MULTITOUCH_WIN_8,
+                       USB_VENDOR_ID_ALPS_JP,
+                       HID_DEVICE_ID_ALPS_1222) },
  
        /* Lenovo X1 TAB Gen 2 */
        { .driver_data = MT_CLS_WIN_8_DUAL,
diff --combined drivers/hid/hid-quirks.c
@@@ -1,4 -1,3 +1,4 @@@
 +// SPDX-License-Identifier: GPL-2.0-or-later
  /*
   *  HID quirks support for Linux
   *
@@@ -10,6 -9,10 +10,6 @@@
   */
  
  /*
 - * This program is free software; you can redistribute it and/or modify it
 - * under the terms of the GNU General Public License as published by the Free
 - * Software Foundation; either version 2 of the License, or (at your option)
 - * any later version.
   */
  
  #include <linux/hid.h>
@@@ -42,6 -45,7 +42,7 @@@ static const struct hid_device_id hid_q
        { HID_USB_DEVICE(USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_UC100KM), HID_QUIRK_NOGET },
        { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_MULTI_TOUCH), HID_QUIRK_MULTI_INPUT },
        { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_PIXART_USB_OPTICAL_MOUSE), HID_QUIRK_ALWAYS_POLL },
+       { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_PIXART_USB_OPTICAL_MOUSE2), HID_QUIRK_ALWAYS_POLL },
        { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_WIRELESS), HID_QUIRK_MULTI_INPUT },
        { HID_USB_DEVICE(USB_VENDOR_ID_CHIC, USB_DEVICE_ID_CHIC_GAMEPAD), HID_QUIRK_BADPAD },
        { HID_USB_DEVICE(USB_VENDOR_ID_CH, USB_DEVICE_ID_CH_3AXIS_5BUTTON_STICK), HID_QUIRK_NOGET },
@@@ -1,8 -1,16 +1,8 @@@
 +// SPDX-License-Identifier: GPL-2.0-only
  /*
   * ISHTP client driver for HID (ISH)
   *
   * Copyright (c) 2014-2016, Intel Corporation.
 - *
 - * This program is free software; you can redistribute it and/or modify it
 - * under the terms and conditions of the GNU General Public License,
 - * version 2, as published by the Free Software Foundation.
 - *
 - * This program is distributed in the hope it will be useful, but WITHOUT
 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
 - * more details.
   */
  
  #include <linux/module.h>
@@@ -891,7 -899,7 +891,7 @@@ static int hid_ishtp_cl_reset(struct is
   */
  static int hid_ishtp_cl_suspend(struct device *device)
  {
-       struct ishtp_cl_device *cl_device = dev_get_drvdata(device);
+       struct ishtp_cl_device *cl_device = ishtp_dev_to_cl_device(device);
        struct ishtp_cl *hid_ishtp_cl = ishtp_get_drvdata(cl_device);
        struct ishtp_cl_data *client_data = ishtp_get_client_data(hid_ishtp_cl);
  
   */
  static int hid_ishtp_cl_resume(struct device *device)
  {
-       struct ishtp_cl_device *cl_device = dev_get_drvdata(device);
+       struct ishtp_cl_device *cl_device = ishtp_dev_to_cl_device(device);
        struct ishtp_cl *hid_ishtp_cl = ishtp_get_drvdata(cl_device);
        struct ishtp_cl_data *client_data = ishtp_get_client_data(hid_ishtp_cl);
  
@@@ -1,8 -1,16 +1,8 @@@
 +// SPDX-License-Identifier: GPL-2.0-only
  /*
   * ISHTP bus driver
   *
   * Copyright (c) 2012-2016, Intel Corporation.
 - *
 - * This program is free software; you can redistribute it and/or modify it
 - * under the terms and conditions of the GNU General Public License,
 - * version 2, as published by the Free Software Foundation.
 - *
 - * This program is distributed in the hope it will be useful, but WITHOUT
 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
 - * more details.
   */
  
  #include <linux/module.h>
@@@ -471,7 -479,6 +471,6 @@@ static struct ishtp_cl_device *ishtp_bu
        }
  
        ishtp_device_ready = true;
-       dev_set_drvdata(&device->dev, device);
  
        return device;
  }
@@@ -639,6 -646,20 +638,20 @@@ void *ishtp_get_drvdata(struct ishtp_cl
  }
  EXPORT_SYMBOL(ishtp_get_drvdata);
  
+ /**
+  * ishtp_dev_to_cl_device() - get ishtp_cl_device instance from device instance
+  * @device: device instance
+  *
+  * Get ish_cl_device instance which embeds device instance in it.
+  *
+  * Return: pointer to ishtp_cl_device instance
+  */
+ struct ishtp_cl_device *ishtp_dev_to_cl_device(struct device *device)
+ {
+       return to_ishtp_cl_device(device);
+ }
+ EXPORT_SYMBOL(ishtp_dev_to_cl_device);
  /**
   * ishtp_bus_new_client() - Create a new client
   * @dev:      ISHTP device instance