]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
4.8-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 22 Nov 2016 08:02:34 +0000 (09:02 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 22 Nov 2016 08:02:34 +0000 (09:02 +0100)
added patches:
gpio-pca953x-fix-corruption-of-other-gpios-in-set_multiple.patch
gpio-pca953x-move-memcpy-into-mutex-lock-for-set-multiple.patch

queue-4.8/gpio-pca953x-fix-corruption-of-other-gpios-in-set_multiple.patch [new file with mode: 0644]
queue-4.8/gpio-pca953x-move-memcpy-into-mutex-lock-for-set-multiple.patch [new file with mode: 0644]
queue-4.8/series

diff --git a/queue-4.8/gpio-pca953x-fix-corruption-of-other-gpios-in-set_multiple.patch b/queue-4.8/gpio-pca953x-fix-corruption-of-other-gpios-in-set_multiple.patch
new file mode 100644 (file)
index 0000000..280857a
--- /dev/null
@@ -0,0 +1,33 @@
+From 53f8d322234649b4d6f1515b20c127a577efd164 Mon Sep 17 00:00:00 2001
+From: Phil Reid <preid@electromag.com.au>
+Date: Tue, 8 Nov 2016 14:00:45 +0800
+Subject: gpio: pca953x: Fix corruption of other gpios in set_multiple.
+
+From: Phil Reid <preid@electromag.com.au>
+
+commit 53f8d322234649b4d6f1515b20c127a577efd164 upstream.
+
+gpiod_set_array_value_complex does not clear the bits field.
+Therefore when the drivers set_multiple funciton is called bits outside
+the mask are undefined and can be either set or not. So bank_val needs
+to be masked with bank_mask before or with the reg_val cache.
+
+Fixes: b4818afeacbd ("gpio: pca953x: Add set_multiple to allow multiple")
+Signed-off-by: Phil Reid <preid@electromag.com.au>
+Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/gpio/gpio-pca953x.c |    1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/drivers/gpio/gpio-pca953x.c
++++ b/drivers/gpio/gpio-pca953x.c
+@@ -380,6 +380,7 @@ static void pca953x_gpio_set_multiple(st
+               if(bankmask) {
+                       unsigned bankval  = bits[bank / sizeof(*bits)] >>
+                                           ((bank % sizeof(*bits)) * 8);
++                      bankval &= bankmask;
+                       reg_val[bank] = (reg_val[bank] & ~bankmask) | bankval;
+               }
+       }
diff --git a/queue-4.8/gpio-pca953x-move-memcpy-into-mutex-lock-for-set-multiple.patch b/queue-4.8/gpio-pca953x-move-memcpy-into-mutex-lock-for-set-multiple.patch
new file mode 100644 (file)
index 0000000..9e76abd
--- /dev/null
@@ -0,0 +1,34 @@
+From 386377b5473043c09b2de40bfe5abfb0fc87e1b4 Mon Sep 17 00:00:00 2001
+From: Phil Reid <preid@electromag.com.au>
+Date: Tue, 8 Nov 2016 13:18:11 +0800
+Subject: gpio: pca953x: Move memcpy into mutex lock for set multiple
+
+From: Phil Reid <preid@electromag.com.au>
+
+commit 386377b5473043c09b2de40bfe5abfb0fc87e1b4 upstream.
+
+Need to ensure that reg_output is not updated while setting multiple
+bits. This makes the mutex locking behaviour for the set_multiple call
+consistent with that of the set_value call.
+
+Fixes: b4818afeacbd ("gpio: pca953x: Add set_multiple to allow multiple")
+Signed-off-by: Phil Reid <preid@electromag.com.au>
+Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/gpio/gpio-pca953x.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/gpio/gpio-pca953x.c
++++ b/drivers/gpio/gpio-pca953x.c
+@@ -372,8 +372,8 @@ static void pca953x_gpio_set_multiple(st
+               break;
+       }
+-      memcpy(reg_val, chip->reg_output, NBANK(chip));
+       mutex_lock(&chip->i2c_lock);
++      memcpy(reg_val, chip->reg_output, NBANK(chip));
+       for(bank=0; bank<NBANK(chip); bank++) {
+               unsigned bankmask = mask[bank / sizeof(*mask)] >>
+                                   ((bank % sizeof(*mask)) * 8);
index e0dec938ba4684b4205d90490bb15de00433152a..32ac118c16a78dc2a76cce1d95ba079ed6004d07 100644 (file)
@@ -64,3 +64,5 @@ ib-hfi1-remove-incorrect-is_err-check.patch
 ib-uverbs-fix-leak-of-xrc-target-qps.patch
 ib-cm-mark-stale-cm-id-s-whenever-the-mad-agent-was-unregistered.patch
 netfilter-nft_dynset-fix-element-timeout-for-hz-1000.patch
+gpio-pca953x-move-memcpy-into-mutex-lock-for-set-multiple.patch
+gpio-pca953x-fix-corruption-of-other-gpios-in-set_multiple.patch