From: Lee Jones <lee@kernel.org>
To: lee@kernel.org, Daniel Thompson <danielt@kernel.org>,
Jingoo Han <jingoohan1@gmail.com>, Helge Deller <deller@gmx.de>,
Daniel Jeong <gshark.jeong@gmail.com>,
LDD MLP <ldd-mlp@list.ti.com>,
Andrew Morton <akpm@linux-foundation.org>,
dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org,
linux-kernel@vger.kernel.org
Cc: stable@vger.kernel.org
Subject: [PATCH 1/6] backlight: lm3630a: Request PWM device before registering backlight
Date: Wed, 4 Nov 2026 18:39:02 +0000 [thread overview]
Message-ID: <20261104183935.1214630-2-lee@kernel.org> (raw)
In-Reply-To: <20261104183935.1214630-1-lee@kernel.org>
lm3630a_probe() currently registers the backlight devices via
lm3630a_backlight_register() before acquiring and initialising the PWM
device via devm_pwm_get() and pwm_init_state().
This creates two issues when PWM control is enabled:
1. Exposing the backlight sysfs attributes before pchip->pwmd is
initialised leaves a window during probe where a userspace brightness
update calls lm3630a_pwm_ctrl() with pchip->pwmd still NULL (or set
to an ERR_PTR() if devm_pwm_get() fails while devres tears down the
backlight device).
2. Because devres releases resources in reverse registration order on
driver unbind, the PWM device is released before the backlight
devices are unregistered, allowing a sysfs brightness write during
unbind to invoke lm3630a_pwm_ctrl() on a freed PWM device.
Acquire and initialise the PWM device before registering the backlight
devices so that pchip->pwmd is valid throughout the lifetime of the
backlight registration.
Fixes: 28e64a68a2ef ("backlight: lm3630: apply chip revision")
Closes: https://sashiko.dev/#/bug/linux-ba01ed63-0b5a-4b3d-94c5-e6989857d77c
Cc: stable@vger.kernel.org
Signed-off-by: Lee Jones <lee@kernel.org>
---
drivers/video/backlight/lm3630a_bl.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/video/backlight/lm3630a_bl.c b/drivers/video/backlight/lm3630a_bl.c
index 8ef8163c7fef..9061355ef8ed 100644
--- a/drivers/video/backlight/lm3630a_bl.c
+++ b/drivers/video/backlight/lm3630a_bl.c
@@ -549,12 +549,6 @@ static int lm3630a_probe(struct i2c_client *client)
dev_err(&client->dev, "fail : init chip\n");
return rval;
}
- /* backlight register */
- rval = lm3630a_backlight_register(pchip);
- if (rval < 0) {
- dev_err(&client->dev, "fail : backlight register.\n");
- return rval;
- }
/* pwm */
if (pdata->pwm_ctrl != LM3630A_PWM_DISABLE) {
pchip->pwmd = devm_pwm_get(pchip->dev, "lm3630a-pwm");
@@ -564,6 +558,12 @@ static int lm3630a_probe(struct i2c_client *client)
pwm_init_state(pchip->pwmd, &pchip->pwmd_state);
}
+ /* backlight register */
+ rval = lm3630a_backlight_register(pchip);
+ if (rval < 0) {
+ dev_err(&client->dev, "fail : backlight register.\n");
+ return rval;
+ }
/* interrupt enable : irq 0 is not allowed */
pchip->irq = client->irq;
--
2.56.0.385.gac671c819a-goog
next prev parent reply other threads:[~2026-11-04 18:39 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-04 18:39 [PATCH 0/6] backlight: Fix Critical and High issues reported by Sashiko Lee Jones
2026-11-04 18:39 ` Lee Jones [this message]
2026-11-04 18:39 ` [PATCH 2/6] backlight: aat2870: Initialise driver data before registering backlight Lee Jones
2026-11-04 18:39 ` [PATCH 3/6] backlight: qcom-wled: Cancel delayed work on probe failure Lee Jones
2026-11-04 18:39 ` [PATCH 4/6] backlight: qcom-wled: Manage teardown via devres and remove wled_remove() Lee Jones
2026-11-04 18:39 ` [PATCH 5/6] backlight: qcom-wled: Check for auto-detection callback in wled_ovp_irq_handler() Lee Jones
2026-11-04 18:39 ` [PATCH 6/6] backlight: qcom-wled: Avoid AB-BA deadlock in wled_module_enable() Lee Jones
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261104183935.1214630-2-lee@kernel.org \
--to=lee@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=danielt@kernel.org \
--cc=deller@gmx.de \
--cc=dri-devel@lists.freedesktop.org \
--cc=gshark.jeong@gmail.com \
--cc=jingoohan1@gmail.com \
--cc=ldd-mlp@list.ti.com \
--cc=linux-fbdev@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox