Skip to content
Commit 2252607d authored by Gregory Fong's avatar Gregory Fong Committed by Linus Walleij
Browse files

gpio: brcmstb: fix null ptr dereference in driver remove



If a failure occurs during probe, brcmstb_gpio_remove() is called. In
remove, we call platform_get_drvdata(), but at the time of failure in
the probe the driver data hadn't yet been set which leads to a NULL
ptr dereference in the remove's list_for_each.  Call
platform_set_drvdata() and set up list head right after allocating the
priv struct to both avoid the null pointer dereference that could
occur today.  To guard against potential future changes, check for
null pointer in remove.

Reported-by: default avatarTim Ross <tross@broadcom.com>
Signed-off-by: default avatarGregory Fong <gregory.0xf0@gmail.com>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent 30bb6fb3
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment