On 10/1/26 10:44 PM, Qing Li wrote:
drv_usbacm_init() fills a local struct stdio_dev and registers it
without clearing the fields it does not set.

Which fields are those ?

With
CONFIG_CONSOLE_FLUSH_SUPPORT=y, console_flush() checks sdev->flush for
non-NULL and then calls it; on Xiaomi crux the uninitialized field held
a leftover pointer, so the first 'go <addr>' command jumped into the
splash image and crashed in console_flush().

Zero-initialize the structure so unused callbacks stay NULL.

Signed-off-by: Qing Li <[email protected]>
---
  drivers/usb/gadget/f_acm.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/gadget/f_acm.c b/drivers/usb/gadget/f_acm.c
index cf16ca83c12..f756aa087ae 100644
--- a/drivers/usb/gadget/f_acm.c
+++ b/drivers/usb/gadget/f_acm.c
@@ -675,7 +675,7 @@ static int acm_stdio_stop(struct stdio_dev *dev)
int drv_usbacm_init(void)
  {
-       struct stdio_dev stdio;
+       struct stdio_dev stdio = {0};
strcpy(stdio.name, "usbacm");
        stdio.flags = DEV_FLAGS_INPUT | DEV_FLAGS_OUTPUT;

[...]

Reply via email to