summarylogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.SRCINFO12
-rw-r--r--0002-surface4-type-cover.patch329
-rw-r--r--0005-ipts-fix-NULL-pointer-dereference.patch31
-rw-r--r--PKGBUILD13
4 files changed, 64 insertions, 321 deletions
diff --git a/.SRCINFO b/.SRCINFO
index e14d7b176b04..e469fc8a64c2 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,5 +1,5 @@
pkgbase = linux-lts-surface4
- pkgver = 4.9.20
+ pkgver = 4.9.26
pkgrel = 1
url = https://www.kernel.org/
arch = i686
@@ -14,8 +14,8 @@ pkgbase = linux-lts-surface4
options = !strip
source = https://www.kernel.org/pub/linux/kernel/v4.x/linux-4.9.tar.xz
source = https://www.kernel.org/pub/linux/kernel/v4.x/linux-4.9.tar.sign
- source = https://www.kernel.org/pub/linux/kernel/v4.x/patch-4.9.20.xz
- source = https://www.kernel.org/pub/linux/kernel/v4.x/patch-4.9.20.sign
+ source = https://www.kernel.org/pub/linux/kernel/v4.x/patch-4.9.26.xz
+ source = https://www.kernel.org/pub/linux/kernel/v4.x/patch-4.9.26.sign
source = config
source = config.x86_64
source = 90-linux.hook
@@ -24,20 +24,22 @@ pkgbase = linux-lts-surface4
source = 0002-surface4-type-cover.patch
source = 0003-add-ipts.patch
source = 0004-i2c-hid-fix.patch
+ source = 0005-ipts-fix-NULL-pointer-dereference.patch
validpgpkeys = ABAF11C65A2970B130ABE3C479BE3E4300411886
validpgpkeys = 647F28654894E3BD457199BE38DBBDC86092693E
sha256sums = 029098dcffab74875e086ae970e3828456838da6e0ba22ce3f64ef764f3d7f1a
sha256sums = SKIP
- sha256sums = fb856acd9195e7d83ef9971ec7be55eca0d6fdf0fbfbe9a8f3bb04590d44b51f
+ sha256sums = f0e2654ffb568cadfa7792f5825830b357acc8c7877bd5a58ef676b191d08c33
sha256sums = SKIP
sha256sums = 53f57faf59621f1db6d97ef5d2e5141ab47278c34ae0308ca7196ad4021149a4
sha256sums = 93f63b05fb6792c16ffda86ce99ab488223347a4a46ea61f9a28523a0289e357
sha256sums = 834bd254b56ab71d73f59b3221f056c72f559553c04718e350ab2a3e2991afe0
sha256sums = 1f036f7464da54ae510630f0edb69faa115287f86d9f17641197ffda8cfd49e0
sha256sums = 1256b241cd477b265a3c2d64bdc19ffe3c9bbcee82ea3994c590c2c76e767d99
- sha256sums = 814f395fb39b5da77699ec5480d8176f6e9eefd5dd50c157945ceba6169a0658
+ sha256sums = fd4e049d03302d0f1c1429f63916e706322bb93cda355b86c5016a183938eb37
sha256sums = c6c6645a1a0e58ed32daf283f3cebafb5c195a2b4091bd1208eda073692ca383
sha256sums = e0337e929f2eb3689332ada9ee0766a9cb06b0cf6ba3dd16416e72009ec91eb9
+ sha256sums = 58f0d86935377ec094a80c9f8793f0378fc5672de87c4bed834e2e80a37330a1
pkgname = linux-lts-surface4
pkgdesc = The Linux-lts-surface4 kernel and modules for Microsoft Surface Pro 4
diff --git a/0002-surface4-type-cover.patch b/0002-surface4-type-cover.patch
index bcf8a9721661..1f4d287bcd9a 100644
--- a/0002-surface4-type-cover.patch
+++ b/0002-surface4-type-cover.patch
@@ -2,21 +2,20 @@ diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index 2b89c701076f..bd8b833f7fb4 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
-@@ -724,12 +724,7 @@ static void hid_scan_collection(struct hid_parser *parser, unsigned type)
+@@ -724,11 +724,7 @@ static void hid_scan_collection(struct hid_parser *parser, unsigned type)
hid->group = HID_GROUP_SENSOR_HUB;
-
+
if (hid->vendor == USB_VENDOR_ID_MICROSOFT &&
- (hid->product == USB_DEVICE_ID_MS_TYPE_COVER_PRO_3 ||
- hid->product == USB_DEVICE_ID_MS_TYPE_COVER_PRO_3_2 ||
- hid->product == USB_DEVICE_ID_MS_TYPE_COVER_PRO_3_JP ||
- hid->product == USB_DEVICE_ID_MS_TYPE_COVER_PRO_4_JP ||
-- hid->product == USB_DEVICE_ID_MS_TYPE_COVER_3 ||
- hid->product == USB_DEVICE_ID_MS_POWER_COVER) &&
+ hid->product == USB_DEVICE_ID_MS_POWER_COVER &&
hid->group == HID_GROUP_MULTITOUCH)
hid->group = HID_GROUP_GENERIC;
-
-@@ -1980,11 +1975,6 @@ static const struct hid_device_id hid_have_special_driver[] = {
+
+@@ -1980,10 +1975,6 @@ static const struct hid_device_id hid_have_special_driver[] = {
{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_DIGITAL_MEDIA_3K) },
{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_WIRELESS_OPTICAL_DESKTOP_3_0) },
{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_OFFICE_KB) },
@@ -24,177 +23,29 @@ index 2b89c701076f..bd8b833f7fb4 100644
- { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_PRO_3_2) },
- { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_PRO_3_JP) },
- { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_PRO_4_JP) },
-- { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_3) },
{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_DIGITAL_MEDIA_7K) },
{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_DIGITAL_MEDIA_600) },
{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_DIGITAL_MEDIA_3KV1) },
-diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
-index 575aa65436d1..3c92c7aefe33 100644
---- a/drivers/hid/hid-ids.h
+diff --git a/drivers/hid/hid-ids.h.orig b/drivers/hid/hid-ids.h
+index da93077..caf5640 100644
+--- a/drivers/hid/hid-ids.h.orig
+++ b/drivers/hid/hid-ids.h
-@@ -718,8 +718,9 @@
- #define USB_DEVICE_ID_MS_TYPE_COVER_PRO_3 0x07dc
- #define USB_DEVICE_ID_MS_TYPE_COVER_PRO_3_2 0x07e2
- #define USB_DEVICE_ID_MS_TYPE_COVER_PRO_3_JP 0x07dd
-+#define USB_DEVICE_ID_MS_TYPE_COVER_PRO_4 0x07e4
-+#define USB_DEVICE_ID_MS_TYPE_COVER_PRO_4_2 0x07e8
- #define USB_DEVICE_ID_MS_TYPE_COVER_PRO_4_JP 0x07e9
--#define USB_DEVICE_ID_MS_TYPE_COVER_3 0x07de
+@@ -724,10 +724,6 @@
+ #define USB_DEVICE_ID_MS_SURFACE_PRO_2 0x0799
+ #define USB_DEVICE_ID_MS_TOUCH_COVER_2 0x07a7
+ #define USB_DEVICE_ID_MS_TYPE_COVER_2 0x07a9
+-#define USB_DEVICE_ID_MS_TYPE_COVER_PRO_3 0x07dc
+-#define USB_DEVICE_ID_MS_TYPE_COVER_PRO_3_2 0x07e2
+-#define USB_DEVICE_ID_MS_TYPE_COVER_PRO_3_JP 0x07dd
+-#define USB_DEVICE_ID_MS_TYPE_COVER_PRO_4_JP 0x07e9
#define USB_DEVICE_ID_MS_POWER_COVER 0x07da
-
+
#define USB_VENDOR_ID_MOJO 0x8282
-diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c
-index fb9ace1cef8b..55db58459531 100644
---- a/drivers/hid/hid-input.c
-+++ b/drivers/hid/hid-input.c
-@@ -1468,6 +1468,31 @@ static void hidinput_cleanup_hidinput(struct hid_device *hid,
- kfree(hidinput);
- }
-
-+static struct hid_input *hidinput_match(struct hid_report *report)
-+{
-+ struct hid_device *hid = report->device;
-+ struct hid_input *hidinput;
-+
-+ list_for_each_entry(hidinput, &hid->inputs, list) {
-+ if (hidinput->report &&
-+ hidinput->report->id == report->id)
-+ return hidinput;
-+ }
-+
-+ return NULL;
-+}
-+
-+static inline void hidinput_configure_usages(struct hid_input *hidinput,
-+ struct hid_report *report)
-+{
-+ int i, j;
-+
-+ for (i = 0; i < report->maxfield; i++)
-+ for (j = 0; j < report->field[i]->maxusage; j++)
-+ hidinput_configure_usage(hidinput, report->field[i],
-+ report->field[i]->usage + j);
-+}
-+
- /*
- * Register the input device; print a message.
- * Configure the input layer interface
-@@ -1478,8 +1503,8 @@ int hidinput_connect(struct hid_device *hid, unsigned int force)
- {
- struct hid_driver *drv = hid->driver;
- struct hid_report *report;
-- struct hid_input *hidinput = NULL;
-- int i, j, k;
-+ struct hid_input *next, *hidinput = NULL;
-+ int i, k;
-
- INIT_LIST_HEAD(&hid->inputs);
- INIT_WORK(&hid->led_work, hidinput_led_worker);
-@@ -1509,43 +1534,40 @@ int hidinput_connect(struct hid_device *hid, unsigned int force)
- if (!report->maxfield)
- continue;
-
-+ /*
-+ * Find the previous hidinput report attached
-+ * to this report id.
-+ */
-+ if (hid->quirks & HID_QUIRK_MULTI_INPUT)
-+ hidinput = hidinput_match(report);
-+
- if (!hidinput) {
- hidinput = hidinput_allocate(hid);
- if (!hidinput)
- goto out_unwind;
- }
-
-- for (i = 0; i < report->maxfield; i++)
-- for (j = 0; j < report->field[i]->maxusage; j++)
-- hidinput_configure_usage(hidinput, report->field[i],
-- report->field[i]->usage + j);
--
-- if ((hid->quirks & HID_QUIRK_NO_EMPTY_INPUT) &&
-- !hidinput_has_been_populated(hidinput))
-- continue;
-+ hidinput_configure_usages(hidinput, report);
-
-- if (hid->quirks & HID_QUIRK_MULTI_INPUT) {
-- /* This will leave hidinput NULL, so that it
-- * allocates another one if we have more inputs on
-- * the same interface. Some devices (e.g. Happ's
-- * UGCI) cram a lot of unrelated inputs into the
-- * same interface. */
-+ if (hid->quirks & HID_QUIRK_MULTI_INPUT)
- hidinput->report = report;
-- if (drv->input_configured &&
-- drv->input_configured(hid, hidinput))
-- goto out_cleanup;
-- if (input_register_device(hidinput->input))
-- goto out_cleanup;
-- hidinput = NULL;
-- }
- }
- }
-
-- if (hidinput && (hid->quirks & HID_QUIRK_NO_EMPTY_INPUT) &&
-- !hidinput_has_been_populated(hidinput)) {
-- /* no need to register an input device not populated */
-- hidinput_cleanup_hidinput(hid, hidinput);
-- hidinput = NULL;
-+ list_for_each_entry_safe(hidinput, next, &hid->inputs, list) {
-+ if ((hid->quirks & HID_QUIRK_NO_EMPTY_INPUT) &&
-+ !hidinput_has_been_populated(hidinput)) {
-+ /* no need to register an input device not populated */
-+ hidinput_cleanup_hidinput(hid, hidinput);
-+ continue;
-+ }
-+
-+ if (drv->input_configured &&
-+ drv->input_configured(hid, hidinput))
-+ goto out_unwind;
-+ if (input_register_device(hidinput->input))
-+ goto out_unwind;
-+ hidinput->registered = true;
- }
-
- if (list_empty(&hid->inputs)) {
-@@ -1553,20 +1575,8 @@ int hidinput_connect(struct hid_device *hid, unsigned int force)
- goto out_unwind;
- }
-
-- if (hidinput) {
-- if (drv->input_configured &&
-- drv->input_configured(hid, hidinput))
-- goto out_cleanup;
-- if (input_register_device(hidinput->input))
-- goto out_cleanup;
-- }
--
- return 0;
-
--out_cleanup:
-- list_del(&hidinput->list);
-- input_free_device(hidinput->input);
-- kfree(hidinput);
- out_unwind:
- /* unwind the ones we already registered */
- hidinput_disconnect(hid);
-@@ -1583,7 +1593,10 @@ void hidinput_disconnect(struct hid_device *hid)
-
- list_for_each_entry_safe(hidinput, next, &hid->inputs, list) {
- list_del(&hidinput->list);
-- input_unregister_device(hidinput->input);
-+ if (hidinput->registered)
-+ input_unregister_device(hidinput->input);
-+ else
-+ input_free_device(hidinput->input);
- kfree(hidinput);
- }
-
diff --git a/drivers/hid/hid-microsoft.c b/drivers/hid/hid-microsoft.c
index c6cd392e9f99..96e7d3231d2f 100644
--- a/drivers/hid/hid-microsoft.c
+++ b/drivers/hid/hid-microsoft.c
-@@ -274,16 +274,6 @@ static const struct hid_device_id ms_devices[] = {
+@@ -274,14 +274,6 @@ static const struct hid_device_id ms_devices[] = {
.driver_data = MS_NOGET },
{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_COMFORT_MOUSE_4500),
.driver_data = MS_DUPLICATE_USAGES },
@@ -206,145 +57,14 @@ index c6cd392e9f99..96e7d3231d2f 100644
- .driver_data = MS_HIDINPUT },
- { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_PRO_4_JP),
- .driver_data = MS_HIDINPUT },
-- { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_3),
-- .driver_data = MS_HIDINPUT },
{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_POWER_COVER),
.driver_data = MS_HIDINPUT },
{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_COMFORT_KEYBOARD),
-diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c
-index fb6f1f447279..89e9032ab1e7 100644
---- a/drivers/hid/hid-multitouch.c
-+++ b/drivers/hid/hid-multitouch.c
-@@ -108,6 +108,7 @@ struct mt_device {
- int cc_value_index; /* contact count value index in the field */
- unsigned last_slot_field; /* the last field of a slot */
- unsigned mt_report_id; /* the report ID of the multitouch device */
-+ unsigned long initial_quirks; /* initial quirks state */
- __s16 inputmode; /* InputMode HID feature, -1 if non-existent */
- __s16 inputmode_index; /* InputMode HID feature index in the report */
- __s16 maxcontact_report_id; /* Maximum Contact Number HID feature,
-@@ -318,13 +319,10 @@ static void mt_get_feature(struct hid_device *hdev, struct hid_report *report)
- u8 *buf;
-
- /*
-- * Only fetch the feature report if initial reports are not already
-- * been retrieved. Currently this is only done for Windows 8 touch
-- * devices.
-+ * Do not fetch the feature report if the device has been explicitly
-+ * marked as non-capable.
- */
-- if (!(hdev->quirks & HID_QUIRK_NO_INIT_REPORTS))
-- return;
-- if (td->mtclass.name != MT_CLS_WIN_8)
-+ if (td->initial_quirks & HID_QUIRK_NO_INIT_REPORTS)
- return;
-
- buf = hid_alloc_report_buf(report, GFP_KERNEL);
-@@ -842,7 +840,9 @@ static int mt_input_mapping(struct hid_device *hdev, struct hid_input *hi,
- if (!td->mtclass.export_all_inputs &&
- field->application != HID_DG_TOUCHSCREEN &&
- field->application != HID_DG_PEN &&
-- field->application != HID_DG_TOUCHPAD)
-+ field->application != HID_DG_TOUCHPAD &&
-+ field->application != HID_GD_KEYBOARD &&
-+ field->application != HID_CP_CONSUMER_CONTROL)
- return -1;
-
- /*
-@@ -1083,36 +1083,6 @@ static int mt_probe(struct hid_device *hdev, const struct hid_device_id *id)
- }
- }
-
-- /* This allows the driver to correctly support devices
-- * that emit events over several HID messages.
-- */
-- hdev->quirks |= HID_QUIRK_NO_INPUT_SYNC;
--
-- /*
-- * This allows the driver to handle different input sensors
-- * that emits events through different reports on the same HID
-- * device.
-- */
-- hdev->quirks |= HID_QUIRK_MULTI_INPUT;
-- hdev->quirks |= HID_QUIRK_NO_EMPTY_INPUT;
--
-- /*
-- * Handle special quirks for Windows 8 certified devices.
-- */
-- if (id->group == HID_GROUP_MULTITOUCH_WIN_8)
-- /*
-- * Some multitouch screens do not like to be polled for input
-- * reports. Fortunately, the Win8 spec says that all touches
-- * should be sent during each report, making the initialization
-- * of input reports unnecessary.
-- *
-- * In addition some touchpads do not behave well if we read
-- * all feature reports from them. Instead we prevent
-- * initial report fetching and then selectively fetch each
-- * report we are interested in.
-- */
-- hdev->quirks |= HID_QUIRK_NO_INIT_REPORTS;
--
- td = devm_kzalloc(&hdev->dev, sizeof(struct mt_device), GFP_KERNEL);
- if (!td) {
- dev_err(&hdev->dev, "cannot allocate multitouch data\n");
-@@ -1136,6 +1106,39 @@ static int mt_probe(struct hid_device *hdev, const struct hid_device_id *id)
- if (id->vendor == HID_ANY_ID && id->product == HID_ANY_ID)
- td->serial_maybe = true;
-
-+ /*
-+ * Store the initial quirk state
-+ */
-+ td->initial_quirks = hdev->quirks;
-+
-+ /* This allows the driver to correctly support devices
-+ * that emit events over several HID messages.
-+ */
-+ hdev->quirks |= HID_QUIRK_NO_INPUT_SYNC;
-+
-+ /*
-+ * This allows the driver to handle different input sensors
-+ * that emits events through different reports on the same HID
-+ * device.
-+ */
-+ hdev->quirks |= HID_QUIRK_MULTI_INPUT;
-+ hdev->quirks |= HID_QUIRK_NO_EMPTY_INPUT;
-+
-+ /*
-+ * Some multitouch screens do not like to be polled for input
-+ * reports. Fortunately, the Win8 spec says that all touches
-+ * should be sent during each report, making the initialization
-+ * of input reports unnecessary. For Win7 devices, well, let's hope
-+ * they will still be happy (this is only be a problem if a touch
-+ * was already there while probing the device).
-+ *
-+ * In addition some touchpads do not behave well if we read
-+ * all feature reports from them. Instead we prevent
-+ * initial report fetching and then selectively fetch each
-+ * report we are interested in.
-+ */
-+ hdev->quirks |= HID_QUIRK_NO_INIT_REPORTS;
-+
- ret = hid_parse(hdev);
- if (ret != 0)
- return ret;
-@@ -1204,8 +1207,11 @@ static int mt_resume(struct hid_device *hdev)
-
- static void mt_remove(struct hid_device *hdev)
- {
-+ struct mt_device *td = hid_get_drvdata(hdev);
-+
- sysfs_remove_group(&hdev->dev.kobj, &mt_attribute_group);
- hid_hw_stop(hdev);
-+ hdev->quirks = td->initial_quirks;
- }
-
- /*
diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c
index e6cfd323babc..5c8ea9ac276f 100644
--- a/drivers/hid/usbhid/hid-quirks.c
+++ b/drivers/hid/usbhid/hid-quirks.c
-@@ -98,11 +98,6 @@ static const struct hid_blacklist {
+@@ -98,10 +98,6 @@ static const struct hid_blacklist {
{ USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_SURFACE_PRO_2, HID_QUIRK_NO_INIT_REPORTS },
{ USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_2, HID_QUIRK_NO_INIT_REPORTS },
{ USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TOUCH_COVER_2, HID_QUIRK_NO_INIT_REPORTS },
@@ -352,19 +72,6 @@ index e6cfd323babc..5c8ea9ac276f 100644
- { USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_PRO_3_2, HID_QUIRK_NO_INIT_REPORTS },
- { USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_PRO_3_JP, HID_QUIRK_NO_INIT_REPORTS },
- { USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_PRO_4_JP, HID_QUIRK_NO_INIT_REPORTS },
-- { USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_3, HID_QUIRK_NO_INIT_REPORTS },
{ USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_POWER_COVER, HID_QUIRK_NO_INIT_REPORTS },
{ USB_VENDOR_ID_MSI, USB_DEVICE_ID_MSI_GT683R_LED_PANEL, HID_QUIRK_NO_INIT_REPORTS },
{ USB_VENDOR_ID_NEXIO, USB_DEVICE_ID_NEXIO_MULTITOUCH_PTI0750, HID_QUIRK_NO_INIT_REPORTS },
-diff --git a/include/linux/hid.h b/include/linux/hid.h
-index b2ec82712baa..596b9232c19e 100644
---- a/include/linux/hid.h
-+++ b/include/linux/hid.h
-@@ -479,6 +479,7 @@ struct hid_input {
- struct list_head list;
- struct hid_report *report;
- struct input_dev *input;
-+ bool registered;
- };
-
- enum hid_type {
diff --git a/0005-ipts-fix-NULL-pointer-dereference.patch b/0005-ipts-fix-NULL-pointer-dereference.patch
new file mode 100644
index 000000000000..6148effc3a02
--- /dev/null
+++ b/0005-ipts-fix-NULL-pointer-dereference.patch
@@ -0,0 +1,31 @@
+From bab1e5b308acfa7572906e70ae959d8db5080b3e Mon Sep 17 00:00:00 2001
+From: Anton Vorontsov <anton@enomsg.org>
+Date: Thu, 29 Dec 2016 15:15:38 -0800
+Subject: [PATCH] misc: ipts: Fix NULL pointer dereference in
+ ipts_hid_release()
+
+If we failed to add a hid device (e.g. firmware failed to load),
+ipts_hid_release() will still be called (by mei_cl_device_remove()) on
+shutdown, which in turn will cause ipts->hid to be dereferenced.
+
+Signed-off-by: Anton Vorontsov <anton@enomsg.org>
+---
+ drivers/misc/ipts/ipts-hid.c | 5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/misc/ipts/ipts-hid.c b/drivers/misc/ipts/ipts-hid.c
+index cc3ad0d..afa740f 100644
+--- a/drivers/misc/ipts/ipts-hid.c
++++ b/drivers/misc/ipts/ipts-hid.c
+@@ -286,8 +286,9 @@ int ipts_hid_init(ipts_info_t *ipts)
+
+ void ipts_hid_release(ipts_info_t *ipts)
+ {
+- struct hid_device *hid = ipts->hid;
+- hid_destroy_device(hid);
++ if (!ipts->hid)
++ return;
++ hid_destroy_device(ipts->hid);
+ }
+
+ int ipts_handle_hid_data(ipts_info_t *ipts,
diff --git a/PKGBUILD b/PKGBUILD
index 776bfcf01b8e..5ea1aa5d0e4e 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -4,7 +4,7 @@
#pkgbase=linux-lts
pkgbase=linux-lts-surface4
_srcname=linux-4.9
-pkgver=4.9.20
+pkgver=4.9.26
pkgrel=1
arch=('i686' 'x86_64')
url="https://www.kernel.org/"
@@ -22,20 +22,22 @@ source=(https://www.kernel.org/pub/linux/kernel/v4.x/${_srcname}.tar.{xz,sign}
change-default-console-loglevel.patch
'0002-surface4-type-cover.patch'
'0003-add-ipts.patch'
- '0004-i2c-hid-fix.patch')
+ '0004-i2c-hid-fix.patch'
+ '0005-ipts-fix-NULL-pointer-dereference.patch')
# https://www.kernel.org/pub/linux/kernel/v4.x/sha256sums.asc
sha256sums=('029098dcffab74875e086ae970e3828456838da6e0ba22ce3f64ef764f3d7f1a'
'SKIP'
- 'fb856acd9195e7d83ef9971ec7be55eca0d6fdf0fbfbe9a8f3bb04590d44b51f'
+ 'f0e2654ffb568cadfa7792f5825830b357acc8c7877bd5a58ef676b191d08c33'
'SKIP'
'53f57faf59621f1db6d97ef5d2e5141ab47278c34ae0308ca7196ad4021149a4'
'93f63b05fb6792c16ffda86ce99ab488223347a4a46ea61f9a28523a0289e357'
'834bd254b56ab71d73f59b3221f056c72f559553c04718e350ab2a3e2991afe0'
'1f036f7464da54ae510630f0edb69faa115287f86d9f17641197ffda8cfd49e0'
'1256b241cd477b265a3c2d64bdc19ffe3c9bbcee82ea3994c590c2c76e767d99'
- '814f395fb39b5da77699ec5480d8176f6e9eefd5dd50c157945ceba6169a0658'
+ 'fd4e049d03302d0f1c1429f63916e706322bb93cda355b86c5016a183938eb37'
'c6c6645a1a0e58ed32daf283f3cebafb5c195a2b4091bd1208eda073692ca383'
- 'e0337e929f2eb3689332ada9ee0766a9cb06b0cf6ba3dd16416e72009ec91eb9')
+ 'e0337e929f2eb3689332ada9ee0766a9cb06b0cf6ba3dd16416e72009ec91eb9'
+ '58f0d86935377ec094a80c9f8793f0378fc5672de87c4bed834e2e80a37330a1')
validpgpkeys=('ABAF11C65A2970B130ABE3C479BE3E4300411886' # Linus Torvalds <torvalds@linux-foundation.org>
'647F28654894E3BD457199BE38DBBDC86092693E' # Greg Kroah-Hartman (Linux kernel stable release signing key) <greg@kroah.com>
)
@@ -55,6 +57,7 @@ prepare() {
patch -p1 -i "${srcdir}/0002-surface4-type-cover.patch"
patch -p1 -i "${srcdir}/0003-add-ipts.patch"
patch -p1 -i "${srcdir}/0004-i2c-hid-fix.patch"
+ patch -p1 -i "${srcdir}/0005-ipts-fix-NULL-pointer-dereference.patch"
# set DEFAULT_CONSOLE_LOGLEVEL to 4 (same value as the 'quiet' kernel param)
# remove this when a Kconfig knob is made available by upstream