From: Greg Kroah-Hartman Date: Tue, 22 Nov 2016 08:02:34 +0000 (+0100) Subject: 4.8-stable patches X-Git-Tag: v4.4.35~2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=36ba649839182bfbb76cfdfce0f768a297fc44c5;p=thirdparty%2Fkernel%2Fstable-queue.git 4.8-stable patches added patches: gpio-pca953x-fix-corruption-of-other-gpios-in-set_multiple.patch gpio-pca953x-move-memcpy-into-mutex-lock-for-set-multiple.patch --- 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 index 00000000000..280857a1bef --- /dev/null +++ b/queue-4.8/gpio-pca953x-fix-corruption-of-other-gpios-in-set_multiple.patch @@ -0,0 +1,33 @@ +From 53f8d322234649b4d6f1515b20c127a577efd164 Mon Sep 17 00:00:00 2001 +From: Phil Reid +Date: Tue, 8 Nov 2016 14:00:45 +0800 +Subject: gpio: pca953x: Fix corruption of other gpios in set_multiple. + +From: Phil Reid + +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 +Signed-off-by: Linus Walleij +Signed-off-by: Greg Kroah-Hartman + +--- + 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 index 00000000000..9e76abd5995 --- /dev/null +++ b/queue-4.8/gpio-pca953x-move-memcpy-into-mutex-lock-for-set-multiple.patch @@ -0,0 +1,34 @@ +From 386377b5473043c09b2de40bfe5abfb0fc87e1b4 Mon Sep 17 00:00:00 2001 +From: Phil Reid +Date: Tue, 8 Nov 2016 13:18:11 +0800 +Subject: gpio: pca953x: Move memcpy into mutex lock for set multiple + +From: Phil Reid + +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 +Signed-off-by: Linus Walleij +Signed-off-by: Greg Kroah-Hartman + +--- + 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> + ((bank % sizeof(*mask)) * 8); diff --git a/queue-4.8/series b/queue-4.8/series index e0dec938ba4..32ac118c16a 100644 --- a/queue-4.8/series +++ b/queue-4.8/series @@ -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