Thread (3 messages) flat view 3 messages, 3 authors, 3d ago

Re: [PATCH net-next] r8169: keep LED device name valid after setup

From: Andrew Lunn <andrew@lunn.ch>
Date: 2026-08-13 15:17:21

On Thu, Aug 13, 2026 at 06:07:11PM +0800, Zhixing Chen wrote:
rtl8168_setup_ldev() and rtl8125_setup_led_ldev() build the LED device
name in a stack buffer and assign it to led_cdev->name.

The LED class device registration path reads led_cdev->name after it has
been assigned, and struct led_classdev stores the name as part of the LED
class device state. Do not keep a pointer to a setup function's stack
buffer there.

Store the name in struct r8169_led_classdev instead, so it remains valid
for the lifetime of the LED class device.
led_classdev_register_ext() does make a copy of name, in order that it
can mangle the name to fit the naming scheme. led-class.c only
accesses led_cdev->name in led_classdev_register_ext(). So i think the
current code is safe.

However, it could become an issue in the future, if the LED core code
ever changes.

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help