summaryrefslogtreecommitdiff
path: root/target/linux/ar71xx
diff options
context:
space:
mode:
authorAndrey Jr. Melnikov <temnota.am@gmail.com>2017-10-08 00:00:28 +0300
committerJohn Crispin <john@phrozen.org>2017-10-07 23:19:15 +0200
commit2cb8f0a4cf0f3d6606cad6b0cff687b71a78c3dd (patch)
treeba85ea94e11b9443879243381f6757ee468603bf /target/linux/ar71xx
parent9c9f7b0434a7f006251026cfe0e60025a377956d (diff)
downloadmtk-20170518-2cb8f0a4cf0f3d6606cad6b0cff687b71a78c3dd.zip
mtk-20170518-2cb8f0a4cf0f3d6606cad6b0cff687b71a78c3dd.tar.gz
mtk-20170518-2cb8f0a4cf0f3d6606cad6b0cff687b71a78c3dd.tar.bz2
ar71xx: Fix NULL pointer dereferece in at803x_link_change_notify()
Check pdata pointer before use to avoid OOPS if dev_get_platdata() return NULL. Signed-off-by: Andrey Jr. Melnikov <temnota.am@gmail.com>
Diffstat (limited to 'target/linux/ar71xx')
-rw-r--r--target/linux/ar71xx/patches-4.4/902-at803x-add-reset-gpio-pdata.patch4
1 files changed, 2 insertions, 2 deletions
diff --git a/target/linux/ar71xx/patches-4.4/902-at803x-add-reset-gpio-pdata.patch b/target/linux/ar71xx/patches-4.4/902-at803x-add-reset-gpio-pdata.patch
index 2244f88..efc8502 100644
--- a/target/linux/ar71xx/patches-4.4/902-at803x-add-reset-gpio-pdata.patch
+++ b/target/linux/ar71xx/patches-4.4/902-at803x-add-reset-gpio-pdata.patch
@@ -42,7 +42,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
*/
if (phydev->state == PHY_NOLINK) {
- if (priv->gpiod_reset && !priv->phy_reset) {
-+ if ((priv->gpiod_reset || pdata->has_reset_gpio) &&
++ if ((priv->gpiod_reset || (pdata && pdata->has_reset_gpio)) &&
+ !priv->phy_reset) {
struct at803x_context context;
@@ -52,7 +52,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
- msleep(1);
- gpiod_set_value(priv->gpiod_reset, 0);
- msleep(1);
-+ if (pdata->has_reset_gpio) {
++ if (pdata && pdata->has_reset_gpio) {
+ gpio_set_value_cansleep(pdata->reset_gpio, 0);
+ msleep(1);
+ gpio_set_value_cansleep(pdata->reset_gpio, 1);