diff options
author | Hauke Mehrtens <hauke@hauke-m.de> | 2020-08-12 00:52:36 +0200 |
---|---|---|
committer | Hauke Mehrtens <hauke@hauke-m.de> | 2020-08-21 11:46:13 +0200 |
commit | bdc7d9691d8d60364f40505d44346e5fa6374f66 (patch) | |
tree | 26bebbdd83b5053dad31886e7117153d9449b5c2 /target/linux | |
parent | 3cd9219e5e16aa38606ea82e4fadb1e0f5f39743 (diff) | |
download | upstream-bdc7d9691d8d60364f40505d44346e5fa6374f66.tar.gz upstream-bdc7d9691d8d60364f40505d44346e5fa6374f66.tar.bz2 upstream-bdc7d9691d8d60364f40505d44346e5fa6374f66.zip |
pistachio: Fix Null pointer access in pwm-img.c
This fixes a crash when booting the board.
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Diffstat (limited to 'target/linux')
-rw-r--r-- | target/linux/pistachio/patches-5.4/150-pwm-img-Fix-null-pointer-access-in-probe.patch | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/target/linux/pistachio/patches-5.4/150-pwm-img-Fix-null-pointer-access-in-probe.patch b/target/linux/pistachio/patches-5.4/150-pwm-img-Fix-null-pointer-access-in-probe.patch new file mode 100644 index 0000000000..d5c573c75c --- /dev/null +++ b/target/linux/pistachio/patches-5.4/150-pwm-img-Fix-null-pointer-access-in-probe.patch @@ -0,0 +1,42 @@ +From 502396fe598126ffd91f962d53a507aa6c7276fc Mon Sep 17 00:00:00 2001 +From: Hauke Mehrtens <hauke@hauke-m.de> +Date: Sat, 15 Aug 2020 16:37:43 +0200 +Subject: [PATCH v2] pwm: img: Fix null pointer access in probe + +dev_get_drvdata() is called in img_pwm_runtime_resume() before the +driver data is set. +When pm_runtime_enabled() returns false in img_pwm_probe() it calls +img_pwm_runtime_resume() which results in a null pointer access. + +This patch fixes the problem by setting the driver data earlier in the +img_pwm_probe() function. + +This crash was seen when booting the Imagination Technologies Creator +Ci40 (Marduk) with kernel 5.4 in OpenWrt. + +Fixes: e690ae526216 ("pwm: img: Add runtime PM") +Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> +Acked-by: Lee Jones <lee.jones@linaro.org> +--- + drivers/pwm/pwm-img.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +--- a/drivers/pwm/pwm-img.c ++++ b/drivers/pwm/pwm-img.c +@@ -277,6 +277,8 @@ static int img_pwm_probe(struct platform + return PTR_ERR(pwm->pwm_clk); + } + ++ platform_set_drvdata(pdev, pwm); ++ + pm_runtime_set_autosuspend_delay(&pdev->dev, IMG_PWM_PM_TIMEOUT); + pm_runtime_use_autosuspend(&pdev->dev); + pm_runtime_enable(&pdev->dev); +@@ -313,7 +315,6 @@ static int img_pwm_probe(struct platform + goto err_suspend; + } + +- platform_set_drvdata(pdev, pwm); + return 0; + + err_suspend: |