* [PATCH] powerpc: sysdev: simple_gpio: fix Oops in gpio save_regs function
@ 2017-05-24 8:01 Christophe Leroy
2017-05-29 9:37 ` Linus Walleij
2017-06-01 13:31 ` Michael Ellerman
0 siblings, 2 replies; 3+ messages in thread
From: Christophe Leroy @ 2017-05-24 8:01 UTC (permalink / raw)
To: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman,
Scott Wood, Linus Walleij
Cc: linux-kernel, linuxppc-dev, linux-gpio, stable
of_mm_gpiochip_add_data() generates an Oops for NULL pointer dereference.
of_mm_gpiochip_add_data() calls mm_gc->save_regs() before
setting the data, therefore ->save_regs() cannot use gpiochip_get_data()
Fixes: 937daafca774b ("powerpc: simple-gpio: use gpiochip data pointer")
Cc: stable@vger.kernel.org
Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
---
arch/powerpc/sysdev/simple_gpio.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/arch/powerpc/sysdev/simple_gpio.c b/arch/powerpc/sysdev/simple_gpio.c
index ef470b470b04..6afddae2fb47 100644
--- a/arch/powerpc/sysdev/simple_gpio.c
+++ b/arch/powerpc/sysdev/simple_gpio.c
@@ -75,7 +75,8 @@ static int u8_gpio_dir_out(struct gpio_chip *gc, unsigned int gpio, int val)
static void u8_gpio_save_regs(struct of_mm_gpio_chip *mm_gc)
{
- struct u8_gpio_chip *u8_gc = gpiochip_get_data(&mm_gc->gc);
+ struct u8_gpio_chip *u8_gc =
+ container_of(mm_gc, struct u8_gpio_chip, mm_gc);
u8_gc->data = in_8(mm_gc->regs);
}
--
2.12.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] powerpc: sysdev: simple_gpio: fix Oops in gpio save_regs function
2017-05-24 8:01 [PATCH] powerpc: sysdev: simple_gpio: fix Oops in gpio save_regs function Christophe Leroy
@ 2017-05-29 9:37 ` Linus Walleij
2017-06-01 13:31 ` Michael Ellerman
1 sibling, 0 replies; 3+ messages in thread
From: Linus Walleij @ 2017-05-29 9:37 UTC (permalink / raw)
To: Christophe Leroy
Cc: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman,
Scott Wood, linux-kernel, linuxppc-dev@lists.ozlabs.org list,
linux-gpio, stable
On Wed, May 24, 2017 at 10:01 AM, Christophe Leroy
<christophe.leroy@c-s.fr> wrote:
> of_mm_gpiochip_add_data() generates an Oops for NULL pointer dereference.
>
> of_mm_gpiochip_add_data() calls mm_gc->save_regs() before
> setting the data, therefore ->save_regs() cannot use gpiochip_get_data()
>
> Fixes: 937daafca774b ("powerpc: simple-gpio: use gpiochip data pointer")
> Cc: stable@vger.kernel.org
>
> Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Sorry for any screwups I've caused...
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: powerpc: sysdev: simple_gpio: fix Oops in gpio save_regs function
2017-05-24 8:01 [PATCH] powerpc: sysdev: simple_gpio: fix Oops in gpio save_regs function Christophe Leroy
2017-05-29 9:37 ` Linus Walleij
@ 2017-06-01 13:31 ` Michael Ellerman
1 sibling, 0 replies; 3+ messages in thread
From: Michael Ellerman @ 2017-06-01 13:31 UTC (permalink / raw)
To: Christophe Leroy, Benjamin Herrenschmidt, Paul Mackerras,
Scott Wood, Linus Walleij
Cc: linux-gpio, linuxppc-dev, linux-kernel, stable
On Wed, 2017-05-24 at 08:01:55 UTC, Christophe Leroy wrote:
> of_mm_gpiochip_add_data() generates an Oops for NULL pointer dereference.
>
> of_mm_gpiochip_add_data() calls mm_gc->save_regs() before
> setting the data, therefore ->save_regs() cannot use gpiochip_get_data()
>
> Fixes: 937daafca774b ("powerpc: simple-gpio: use gpiochip data pointer")
> Cc: stable@vger.kernel.org
>
> Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
> Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Applied to powerpc fixes, thanks.
https://git.kernel.org/powerpc/c/6f553912eedafae13ff20b322a65e4
cheers
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-06-01 13:31 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-24 8:01 [PATCH] powerpc: sysdev: simple_gpio: fix Oops in gpio save_regs function Christophe Leroy
2017-05-29 9:37 ` Linus Walleij
2017-06-01 13:31 ` Michael Ellerman
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.