Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1663918 > unrolled thread

[PATCH 4.9 092/119] powerpc/sysdev/simple_gpio: Fix oops in gpio save_regs function

Started byGreg Kroah-Hartman <gregkh@linuxfoundation.org>
First post2017-06-12 18:40 +0200
Last post2017-06-12 18:40 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 4.9 092/119] powerpc/sysdev/simple_gpio: Fix oops in gpio save_regs function Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-06-12 18:40 +0200

#1663918 — [PATCH 4.9 092/119] powerpc/sysdev/simple_gpio: Fix oops in gpio save_regs function

FromGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Date2017-06-12 18:40 +0200
Subject[PATCH 4.9 092/119] powerpc/sysdev/simple_gpio: Fix oops in gpio save_regs function
Message-ID<tRAxJ-4uO-35@gated-at.bofh.it>
4.9-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Christophe Leroy <christophe.leroy@c-s.fr>

commit 6f553912eedafae13ff20b322a65e471fe7f5236 upstream.

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: 937daafca774 ("powerpc: simple-gpio: use gpiochip data pointer")
Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/powerpc/sysdev/simple_gpio.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- 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_c
 
 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);
 }

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web