[PATCH v3 1/4] backlight: qcom-wled: Fix NULL pointer dereference in PM callbacks
From: David Heidelberg via B4 Relay
Date: Mon Sep 14 2026 - 14:43:18 EST
From: David Heidelberg <david@xxxxxxx>
wled_probe() doesn't set the driver data for the platform device.
As a result, dev_get_drvdata() in wled_remove() will return NULL,
leading to a NULL pointer dereference afterward.
Set the platform device driver data in wled_probe().
Cc: stable@xxxxxxxxxxxxxxx
Fixes: feeab87b3072 ("backlight: qcom-wled: Add support for short circuit handling")
Signed-off-by: David Heidelberg <david@xxxxxxx>
---
drivers/video/backlight/qcom-wled.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/video/backlight/qcom-wled.c b/drivers/video/backlight/qcom-wled.c
index 650dd95f06ef5..a76158a298335 100644
--- a/drivers/video/backlight/qcom-wled.c
+++ b/drivers/video/backlight/qcom-wled.c
@@ -1747,16 +1747,17 @@ static int wled_probe(struct platform_device *pdev)
memset(&props, 0, sizeof(struct backlight_properties));
props.type = BACKLIGHT_RAW;
props.brightness = val;
props.max_brightness = wled->max_brightness;
bl = devm_backlight_device_register(&pdev->dev, wled->name,
&pdev->dev, wled,
&wled_ops, &props);
+ platform_set_drvdata(pdev, bl);
return PTR_ERR_OR_ZERO(bl);
};
static void wled_remove(struct platform_device *pdev)
{
struct wled *wled = platform_get_drvdata(pdev);
mutex_destroy(&wled->lock);
--
2.55.0