Skip to contentSkip to conversation

New: usb: dwc2: memory leak of hsotg->regset

Bug 219977 [email protected] 1 participant 2 messages Apr 3, 2025 – Aug 10 USB

lore
Share & tools
lore
#0 lore raw

https://bugzilla.kernel.org/show_bug.cgi?id=219977

            Bug ID: 219977
           Summary: usb: dwc2: memory leak of hsotg->regset
           Product: Drivers
           Version: 2.5
          Hardware: All
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P3
         Component: USB
          Assignee: [email protected]
          Reporter: [email protected]
        Regression: No

Hi,

In drivers/usb/dwc2/debugfs.c line 790:
https://web.git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/drivers/usb/dwc2/debugfs.c?h=v6.13.9

790:

        hsotg->regset = devm_kzalloc(hsotg->dev, sizeof(*hsotg->regset),
                                                                GFP_KERNEL);

"hsotg->regset" is allocated but not be released in dwc2_debugfs_exit().

FYI.
dwc3 was fixed same issue in commit e6bdf8195b4a43ebff71f25fc7ca5e436e79161a.

Signature · 4 lines
You may reply to this email to add a comment.

You are receiving this mail because:
You are watching the assignee of the bug.
#1 lore raw

[Bug 219977] usb: dwc2: memory leak of hsotg->regset

https://bugzilla.kernel.org/show_bug.cgi?id=219977

Wei Huang ([email protected]) changed:

What |Removed |Added
----------------------------------------------------------------------------
CC| |[email protected]

--- Comment #1 from Wei Huang ([email protected]) --- Hi kakapapa2,

Thanks for reporting this. A fix has been submitted to the linux-usb mailing list:
https://lore.kernel.org/linux-usb/?q=huangwei%40kylinos.cn

The fix mirrors the equivalent dwc3 fix (commit e6bdf8195b4a) by switching hsotg->regset from devm_kzalloc() to kzalloc() and freeing it explicitly in dwc2_debugfs_exit().

https://lore.kernel.org/linux-usb/[email protected]/

Signature · 4 lines
You may reply to this email to add a comment.

You are receiving this mail because:
You are watching the assignee of the bug.