]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
4.4-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 14 Jan 2019 17:43:58 +0000 (18:43 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 14 Jan 2019 17:43:58 +0000 (18:43 +0100)
added patches:
acpi-power-skip-duplicate-power-resource-references-in-_prx.patch
i2c-dev-prevent-adapter-retries-and-timeout-being-set-as-minus-value.patch

queue-4.4/acpi-power-skip-duplicate-power-resource-references-in-_prx.patch [new file with mode: 0644]
queue-4.4/i2c-dev-prevent-adapter-retries-and-timeout-being-set-as-minus-value.patch [new file with mode: 0644]
queue-4.4/series

diff --git a/queue-4.4/acpi-power-skip-duplicate-power-resource-references-in-_prx.patch b/queue-4.4/acpi-power-skip-duplicate-power-resource-references-in-_prx.patch
new file mode 100644 (file)
index 0000000..db6e6af
--- /dev/null
@@ -0,0 +1,87 @@
+From 7d7b467cb95bf29597b417d4990160d4ea6d69b9 Mon Sep 17 00:00:00 2001
+From: Hans de Goede <hdegoede@redhat.com>
+Date: Sun, 30 Dec 2018 18:25:00 +0100
+Subject: ACPI: power: Skip duplicate power resource references in _PRx
+
+From: Hans de Goede <hdegoede@redhat.com>
+
+commit 7d7b467cb95bf29597b417d4990160d4ea6d69b9 upstream.
+
+Some ACPI tables contain duplicate power resource references like this:
+
+        Name (_PR0, Package (0x04)  // _PR0: Power Resources for D0
+        {
+            P28P,
+            P18P,
+            P18P,
+            CLK4
+        })
+
+This causes a WARN_ON in sysfs_add_link_to_group() because we end up
+adding a link to the same acpi_device twice:
+
+sysfs: cannot create duplicate filename '/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/808622C1:00/OVTI2680:00/power_resources_D0/LNXPOWER:0a'
+CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.19.12-301.fc29.x86_64 #1
+Hardware name: Insyde CherryTrail/Type2 - Board Product Name, BIOS jumperx.T87.KFBNEEA02 04/13/2016
+Call Trace:
+ dump_stack+0x5c/0x80
+ sysfs_warn_dup.cold.3+0x17/0x2a
+ sysfs_do_create_link_sd.isra.2+0xa9/0xb0
+ sysfs_add_link_to_group+0x30/0x50
+ acpi_power_expose_list+0x74/0xa0
+ acpi_power_add_remove_device+0x50/0xa0
+ acpi_add_single_object+0x26b/0x5f0
+ acpi_bus_check_add+0xc4/0x250
+ ...
+
+To address this issue, make acpi_extract_power_resources() check for
+duplicates and simply skip them when found.
+
+Cc: All applicable <stable@vger.kernel.org>
+Signed-off-by: Hans de Goede <hdegoede@redhat.com>
+[ rjw: Subject & changelog, comments ]
+Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/acpi/power.c |   22 ++++++++++++++++++++++
+ 1 file changed, 22 insertions(+)
+
+--- a/drivers/acpi/power.c
++++ b/drivers/acpi/power.c
+@@ -131,6 +131,23 @@ void acpi_power_resources_list_free(stru
+       }
+ }
++static bool acpi_power_resource_is_dup(union acpi_object *package,
++                                     unsigned int start, unsigned int i)
++{
++      acpi_handle rhandle, dup;
++      unsigned int j;
++
++      /* The caller is expected to check the package element types */
++      rhandle = package->package.elements[i].reference.handle;
++      for (j = start; j < i; j++) {
++              dup = package->package.elements[j].reference.handle;
++              if (dup == rhandle)
++                      return true;
++      }
++
++      return false;
++}
++
+ int acpi_extract_power_resources(union acpi_object *package, unsigned int start,
+                                struct list_head *list)
+ {
+@@ -150,6 +167,11 @@ int acpi_extract_power_resources(union a
+                       err = -ENODEV;
+                       break;
+               }
++
++              /* Some ACPI tables contain duplicate power resource references */
++              if (acpi_power_resource_is_dup(package, start, i))
++                      continue;
++
+               err = acpi_add_power_resource(rhandle);
+               if (err)
+                       break;
diff --git a/queue-4.4/i2c-dev-prevent-adapter-retries-and-timeout-being-set-as-minus-value.patch b/queue-4.4/i2c-dev-prevent-adapter-retries-and-timeout-being-set-as-minus-value.patch
new file mode 100644 (file)
index 0000000..15c9c7d
--- /dev/null
@@ -0,0 +1,50 @@
+From 6ebec961d59bccf65d08b13fc1ad4e6272a89338 Mon Sep 17 00:00:00 2001
+From: Yi Zeng <yizeng@asrmicro.com>
+Date: Wed, 9 Jan 2019 15:33:07 +0800
+Subject: i2c: dev: prevent adapter retries and timeout being set as minus value
+
+From: Yi Zeng <yizeng@asrmicro.com>
+
+commit 6ebec961d59bccf65d08b13fc1ad4e6272a89338 upstream.
+
+If adapter->retries is set to a minus value from user space via ioctl,
+it will make __i2c_transfer and __i2c_smbus_xfer skip the calling to
+adapter->algo->master_xfer and adapter->algo->smbus_xfer that is
+registered by the underlying bus drivers, and return value 0 to all the
+callers. The bus driver will never be accessed anymore by all users,
+besides, the users may still get successful return value without any
+error or information log print out.
+
+If adapter->timeout is set to minus value from user space via ioctl,
+it will make the retrying loop in __i2c_transfer and __i2c_smbus_xfer
+always break after the the first try, due to the time_after always
+returns true.
+
+Signed-off-by: Yi Zeng <yizeng@asrmicro.com>
+[wsa: minor grammar updates to commit message]
+Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
+Cc: stable@kernel.org
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/i2c/i2c-dev.c |    6 ++++++
+ 1 file changed, 6 insertions(+)
+
+--- a/drivers/i2c/i2c-dev.c
++++ b/drivers/i2c/i2c-dev.c
+@@ -459,9 +459,15 @@ static long i2cdev_ioctl(struct file *fi
+               return i2cdev_ioctl_smbus(client, arg);
+       case I2C_RETRIES:
++              if (arg > INT_MAX)
++                      return -EINVAL;
++
+               client->adapter->retries = arg;
+               break;
+       case I2C_TIMEOUT:
++              if (arg > INT_MAX)
++                      return -EINVAL;
++
+               /* For historical reasons, user-space sets the timeout
+                * value in units of 10 ms.
+                */
index 01e45f423230b1ddbdaaa37d836b073d8918944d..c29dcc1547e573334d84ced993c0cb26fdf7b411 100644 (file)
@@ -44,3 +44,5 @@ pci-altera-poll-for-link-up-status-after-retraining-the-link.patch
 pci-altera-poll-for-link-training-status-after-retraining-the-link.patch
 pci-altera-rework-config-accessors-for-use-without-a-struct-pci_bus.patch
 pci-altera-move-retrain-from-fixup-to-altera_pcie_host_init.patch
+acpi-power-skip-duplicate-power-resource-references-in-_prx.patch
+i2c-dev-prevent-adapter-retries-and-timeout-being-set-as-minus-value.patch