[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20161124145500.669837295@linuxfoundation.org>
Date:   Thu, 24 Nov 2016 16:28:01 +0100
From:   Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To:     linux-kernel@...r.kernel.org
Cc:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        stable@...r.kernel.org, Phil Reid <preid@...ctromag.com.au>,
        Linus Walleij <linus.walleij@...aro.org>
Subject: [PATCH 4.8 67/67] gpio: pca953x: Fix corruption of other gpios in set_multiple.
4.8-stable review patch.  If anyone has any objections, please let me know.
------------------
From: Phil Reid <preid@...ctromag.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@...ctromag.com.au>
Signed-off-by: Linus Walleij <linus.walleij@...aro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@...uxfoundation.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;
 		}
 	}
Powered by blists - more mailing lists
 
