Skip to contentSkip to conversation

Patch "powerpc/sysdev/simple_gpio: Fix oops in gpio save_regs function" has been added to the 4.9-stable tree

PATCH [email protected] 1 participant 1 message Jun 12, 2017

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

powerpc/sysdev/simple_gpio: Fix oops in gpio save_regs function

to the 4.9-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
powerpc-sysdev-simple_gpio-fix-oops-in-gpio-save_regs-function.patch
and it can be found in the queue-4.9 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From 6f553912eedafae13ff20b322a65e471fe7f5236 Mon Sep 17 00:00:00 2001

From: Christophe Leroy <[email protected]>
Date: Wed, 24 May 2017 10:01:55 +0200
Subject: powerpc/sysdev/simple_gpio: Fix oops in gpio save_regs function

From: Christophe Leroy <[email protected]>

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")
---
 arch/powerpc/sysdev/simple_gpio.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
arch/powerpc/sysdev/simple_gpio.c +2 -1
@@ -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);
 }

Patches currently in stable-queue which might be from [email protected] are

queue-4.9/powerpc-sysdev-simple_gpio-fix-oops-in-gpio-save_regs-function.patch