Commit c72e455
leds: leds-st1202: Fix NULL pointer access on race condition
st1202_dt_init() calls devm_led_classdev_register_ext() before the
internal data structures are properly set up, so the LEDs become visible
to user space while being partially initialized, leading to a window
where trying to access them causes a NULL pointer access.
Move devm_led_classdev_register_ext() from DT initialization
to the end of the probe function when DT and hardware are fully
initialized and ready to interact with user space.
Fixes: 2592303 ("leds: Add LED1202 I2C driver")
Signed-off-by: Manuel Fombuena <fombuena@outlook.com>
Link: https://lore.kernel.org/r/CWLP123MB54732771AC0CE5491B3C84DCC5C32@CWLP123MB5473.GBRP123.PROD.OUTLOOK.COM
Signed-off-by: Lee Jones <lee@kernel.org>1 parent 2014c95 commit c72e455
1 file changed
+10
-11
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
261 | 261 | | |
262 | 262 | | |
263 | 263 | | |
264 | | - | |
265 | | - | |
266 | 264 | | |
267 | 265 | | |
268 | 266 | | |
| |||
276 | 274 | | |
277 | 275 | | |
278 | 276 | | |
279 | | - | |
280 | | - | |
281 | | - | |
282 | | - | |
283 | | - | |
284 | | - | |
285 | | - | |
286 | | - | |
287 | | - | |
288 | 277 | | |
289 | 278 | | |
290 | 279 | | |
| |||
368 | 357 | | |
369 | 358 | | |
370 | 359 | | |
| 360 | + | |
371 | 361 | | |
372 | 362 | | |
373 | 363 | | |
| |||
384 | 374 | | |
385 | 375 | | |
386 | 376 | | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
387 | 386 | | |
388 | 387 | | |
389 | 388 | | |
| |||
0 commit comments