[PATCH v4 1/4] backlight: qcom-wled: Fix NULL pointer dereference in wled_remove()
From: David Heidelberg via B4 Relay
Date: Mon Sep 21 2026 - 06:50:46 EST
From: David Heidelberg <david@xxxxxxx>
wled_probe() doesn't set the driver data for the platform device.
As a result, platform_get_drvdata() in wled_remove() will return NULL,
and the first dereference of it crashes on unbind.
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..2281007bdd459 100644
--- a/drivers/video/backlight/qcom-wled.c
+++ b/drivers/video/backlight/qcom-wled.c
@@ -1675,16 +1675,17 @@ static int wled_probe(struct platform_device *pdev)
}
wled = devm_kzalloc(&pdev->dev, sizeof(*wled), GFP_KERNEL);
if (!wled)
return -ENOMEM;
wled->regmap = regmap;
wled->dev = &pdev->dev;
+ platform_set_drvdata(pdev, wled);
wled->version = (uintptr_t)of_device_get_match_data(&pdev->dev);
if (!wled->version) {
dev_err(&pdev->dev, "Unknown device version\n");
return -ENODEV;
}
mutex_init(&wled->lock);
--
2.55.0