]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
4.9-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 18 Oct 2021 10:55:24 +0000 (12:55 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 18 Oct 2021 10:55:24 +0000 (12:55 +0200)
added patches:
iio-adc128s052-fix-the-error-handling-path-of-adc128_probe.patch
iio-light-opt3001-fixed-timeout-error-when-0-lux.patch
iio-ssp_sensors-add-more-range-checking-in-ssp_parse_dataframe.patch
iio-ssp_sensors-fix-error-code-in-ssp_print_mcu_debug.patch

queue-4.9/iio-adc128s052-fix-the-error-handling-path-of-adc128_probe.patch [new file with mode: 0644]
queue-4.9/iio-light-opt3001-fixed-timeout-error-when-0-lux.patch [new file with mode: 0644]
queue-4.9/iio-ssp_sensors-add-more-range-checking-in-ssp_parse_dataframe.patch [new file with mode: 0644]
queue-4.9/iio-ssp_sensors-fix-error-code-in-ssp_print_mcu_debug.patch [new file with mode: 0644]
queue-4.9/series

diff --git a/queue-4.9/iio-adc128s052-fix-the-error-handling-path-of-adc128_probe.patch b/queue-4.9/iio-adc128s052-fix-the-error-handling-path-of-adc128_probe.patch
new file mode 100644 (file)
index 0000000..aba63ea
--- /dev/null
@@ -0,0 +1,42 @@
+From bbcf40816b547b3c37af49168950491d20d81ce1 Mon Sep 17 00:00:00 2001
+From: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
+Date: Sat, 21 Aug 2021 12:37:24 +0200
+Subject: iio: adc128s052: Fix the error handling path of 'adc128_probe()'
+
+From: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
+
+commit bbcf40816b547b3c37af49168950491d20d81ce1 upstream.
+
+A successful 'regulator_enable()' call should be balanced by a
+corresponding 'regulator_disable()' call in the error handling path of the
+probe, as already done in the remove function.
+
+Update the error handling path accordingly.
+
+Fixes: 913b86468674 ("iio: adc: Add TI ADC128S052")
+Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
+Reviewed-by: Alexandru Ardelean <ardeleanalex@gmail.com>
+Link: https://lore.kernel.org/r/85189f1cfcf6f5f7b42d8730966f2a074b07b5f5.1629542160.git.christophe.jaillet@wanadoo.fr
+Cc: <Stable@vger.kernel.org>
+Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/iio/adc/ti-adc128s052.c |    6 ++++++
+ 1 file changed, 6 insertions(+)
+
+--- a/drivers/iio/adc/ti-adc128s052.c
++++ b/drivers/iio/adc/ti-adc128s052.c
+@@ -169,7 +169,13 @@ static int adc128_probe(struct spi_devic
+       mutex_init(&adc->lock);
+       ret = iio_device_register(indio_dev);
++      if (ret)
++              goto err_disable_regulator;
++      return 0;
++
++err_disable_regulator:
++      regulator_disable(adc->reg);
+       return ret;
+ }
diff --git a/queue-4.9/iio-light-opt3001-fixed-timeout-error-when-0-lux.patch b/queue-4.9/iio-light-opt3001-fixed-timeout-error-when-0-lux.patch
new file mode 100644 (file)
index 0000000..d997788
--- /dev/null
@@ -0,0 +1,44 @@
+From 26d90b5590579def54382a2fc34cfbe8518a9851 Mon Sep 17 00:00:00 2001
+From: Jiri Valek - 2N <valek@2n.cz>
+Date: Mon, 20 Sep 2021 14:53:48 +0200
+Subject: iio: light: opt3001: Fixed timeout error when 0 lux
+
+From: Jiri Valek - 2N <valek@2n.cz>
+
+commit 26d90b5590579def54382a2fc34cfbe8518a9851 upstream.
+
+Reading from sensor returned timeout error under
+zero light conditions.
+
+Signed-off-by: Jiri Valek - 2N <valek@2n.cz>
+Fixes: ac663db3678a ("iio: light: opt3001: enable operation w/o IRQ")
+Link: https://lore.kernel.org/r/20210920125351.6569-1-valek@2n.cz
+Cc: <Stable@vger.kernel.org>
+Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/iio/light/opt3001.c |    6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+--- a/drivers/iio/light/opt3001.c
++++ b/drivers/iio/light/opt3001.c
+@@ -283,6 +283,8 @@ static int opt3001_get_lux(struct opt300
+               ret = wait_event_timeout(opt->result_ready_queue,
+                               opt->result_ready,
+                               msecs_to_jiffies(OPT3001_RESULT_READY_LONG));
++              if (ret == 0)
++                      return -ETIMEDOUT;
+       } else {
+               /* Sleep for result ready time */
+               timeout = (opt->int_time == OPT3001_INT_TIME_SHORT) ?
+@@ -319,9 +321,7 @@ err:
+               /* Disallow IRQ to access the device while lock is active */
+               opt->ok_to_ignore_lock = false;
+-      if (ret == 0)
+-              return -ETIMEDOUT;
+-      else if (ret < 0)
++      if (ret < 0)
+               return ret;
+       if (opt->use_irq) {
diff --git a/queue-4.9/iio-ssp_sensors-add-more-range-checking-in-ssp_parse_dataframe.patch b/queue-4.9/iio-ssp_sensors-add-more-range-checking-in-ssp_parse_dataframe.patch
new file mode 100644 (file)
index 0000000..33298ff
--- /dev/null
@@ -0,0 +1,57 @@
+From 8167c9a375ccceed19048ad9d68cb2d02ed276e0 Mon Sep 17 00:00:00 2001
+From: Dan Carpenter <dan.carpenter@oracle.com>
+Date: Thu, 9 Sep 2021 12:13:36 +0300
+Subject: iio: ssp_sensors: add more range checking in ssp_parse_dataframe()
+
+From: Dan Carpenter <dan.carpenter@oracle.com>
+
+commit 8167c9a375ccceed19048ad9d68cb2d02ed276e0 upstream.
+
+The "idx" is validated at the start of the loop but it gets incremented
+during the iteration so it needs to be checked again.
+
+Fixes: 50dd64d57eee ("iio: common: ssp_sensors: Add sensorhub driver")
+Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
+Link: https://lore.kernel.org/r/20210909091336.GA26312@kili
+Cc: <Stable@vger.kernel.org>
+Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/iio/common/ssp_sensors/ssp_spi.c |    9 ++++++++-
+ 1 file changed, 8 insertions(+), 1 deletion(-)
+
+--- a/drivers/iio/common/ssp_sensors/ssp_spi.c
++++ b/drivers/iio/common/ssp_sensors/ssp_spi.c
+@@ -286,6 +286,8 @@ static int ssp_parse_dataframe(struct ss
+       for (idx = 0; idx < len;) {
+               switch (dataframe[idx++]) {
+               case SSP_MSG2AP_INST_BYPASS_DATA:
++                      if (idx >= len)
++                              return -EPROTO;
+                       sd = dataframe[idx++];
+                       if (sd < 0 || sd >= SSP_SENSOR_MAX) {
+                               dev_err(SSP_DEV,
+@@ -295,10 +297,13 @@ static int ssp_parse_dataframe(struct ss
+                       if (indio_devs[sd]) {
+                               spd = iio_priv(indio_devs[sd]);
+-                              if (spd->process_data)
++                              if (spd->process_data) {
++                                      if (idx >= len)
++                                              return -EPROTO;
+                                       spd->process_data(indio_devs[sd],
+                                                         &dataframe[idx],
+                                                         data->timestamp);
++                              }
+                       } else {
+                               dev_err(SSP_DEV, "no client for frame\n");
+                       }
+@@ -306,6 +311,8 @@ static int ssp_parse_dataframe(struct ss
+                       idx += ssp_offset_map[sd];
+                       break;
+               case SSP_MSG2AP_INST_DEBUG_DATA:
++                      if (idx >= len)
++                              return -EPROTO;
+                       sd = ssp_print_mcu_debug(dataframe, &idx, len);
+                       if (sd) {
+                               dev_err(SSP_DEV,
diff --git a/queue-4.9/iio-ssp_sensors-fix-error-code-in-ssp_print_mcu_debug.patch b/queue-4.9/iio-ssp_sensors-fix-error-code-in-ssp_print_mcu_debug.patch
new file mode 100644 (file)
index 0000000..f3cadf9
--- /dev/null
@@ -0,0 +1,35 @@
+From 4170d3dd1467e9d78cb9af374b19357dc324b328 Mon Sep 17 00:00:00 2001
+From: Dan Carpenter <dan.carpenter@oracle.com>
+Date: Tue, 14 Sep 2021 13:53:33 +0300
+Subject: iio: ssp_sensors: fix error code in ssp_print_mcu_debug()
+
+From: Dan Carpenter <dan.carpenter@oracle.com>
+
+commit 4170d3dd1467e9d78cb9af374b19357dc324b328 upstream.
+
+The ssp_print_mcu_debug() function should return negative error codes on
+error.  Returning "length" is meaningless.  This change does not affect
+runtime because the callers only care about zero/non-zero.
+
+Reported-by: Jonathan Cameron <jic23@kernel.org>
+Fixes: 50dd64d57eee ("iio: common: ssp_sensors: Add sensorhub driver")
+Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
+Link: https://lore.kernel.org/r/20210914105333.GA11657@kili
+Cc: <Stable@vger.kernel.org>
+Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/iio/common/ssp_sensors/ssp_spi.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/iio/common/ssp_sensors/ssp_spi.c
++++ b/drivers/iio/common/ssp_sensors/ssp_spi.c
+@@ -147,7 +147,7 @@ static int ssp_print_mcu_debug(char *dat
+       if (length > received_len - *data_index || length <= 0) {
+               ssp_dbg("[SSP]: MSG From MCU-invalid debug length(%d/%d)\n",
+                       length, received_len);
+-              return length ? length : -EPROTO;
++              return -EPROTO;
+       }
+       ssp_dbg("[SSP]: MSG From MCU - %s\n", &data_frame[*data_index]);
index 07ca48a482de83a6b870c07f74d724efe1ce056c..1fa48762573ca4e7aad6206995707fd16d883a6e 100644 (file)
@@ -8,3 +8,7 @@ input-xpad-add-support-for-another-usb-id-of-nacon-gc-100.patch
 usb-serial-qcserial-add-em9191-qdl-support.patch
 usb-serial-option-add-telit-le910cx-composition-0x1204.patch
 nvmem-fix-shift-out-of-bound-ubsan-with-byte-size-cells.patch
+iio-adc128s052-fix-the-error-handling-path-of-adc128_probe.patch
+iio-light-opt3001-fixed-timeout-error-when-0-lux.patch
+iio-ssp_sensors-add-more-range-checking-in-ssp_parse_dataframe.patch
+iio-ssp_sensors-fix-error-code-in-ssp_print_mcu_debug.patch