Linux USB
 help / color / mirror / Atom feed
* [Bug 219977] New: usb: dwc2: memory leak of hsotg->regset
@ 2025-04-03  8:49 bugzilla-daemon
  2026-08-10  7:10 ` [Bug 219977] " bugzilla-daemon
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: bugzilla-daemon @ 2025-04-03  8:49 UTC (permalink / raw)
  To: linux-usb

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: drivers_usb@kernel-bugs.kernel.org
          Reporter: kakapapa2@gmail.com
        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.

-- 
You may reply to this email to add a comment.

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug 219977] usb: dwc2: memory leak of hsotg->regset
  2025-04-03  8:49 [Bug 219977] New: usb: dwc2: memory leak of hsotg->regset bugzilla-daemon
@ 2026-08-10  7:10 ` bugzilla-daemon
  2026-11-16  2:37 ` bugzilla-daemon
  2026-11-16  5:01 ` bugzilla-daemon
  2 siblings, 0 replies; 4+ messages in thread
From: bugzilla-daemon @ 2026-08-10  7:10 UTC (permalink / raw)
  To: linux-usb

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

Wei Huang (huangwei@kylinos.cn) changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |huangwei@kylinos.cn

--- Comment #1 from Wei Huang (huangwei@kylinos.cn) ---
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/20260807100400.3179625-1-huangwei@kylinos.cn/

-- 
You may reply to this email to add a comment.

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug 219977] usb: dwc2: memory leak of hsotg->regset
  2025-04-03  8:49 [Bug 219977] New: usb: dwc2: memory leak of hsotg->regset bugzilla-daemon
  2026-08-10  7:10 ` [Bug 219977] " bugzilla-daemon
@ 2026-11-16  2:37 ` bugzilla-daemon
  2026-11-16  5:01 ` bugzilla-daemon
  2 siblings, 0 replies; 4+ messages in thread
From: bugzilla-daemon @ 2026-11-16  2:37 UTC (permalink / raw)
  To: linux-usb

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

Wei Huang (daway320@163.com) changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |daway320@163.com

--- Comment #2 from Wei Huang (daway320@163.com) ---
Hi kakapapa2,

Good news - the fix for this issue has been merged into the mainline
kernel.

The patch was reviewed by the Synopsys DWC3 maintainer (Thinh
Nguyen) and merged via Greg Kroah-Hartman's USB tree during the
7.4 merge window:

    usb: dwc2: debugfs: fix memory leak of hsotg->regset
   
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=8c7d5b1f34f0

The fix switches hsotg->regset from devm_kzalloc() to kzalloc() and
frees it explicitly in dwc2_debugfs_exit(), mirroring the equivalent
dwc3 fix (commit e6bdf8195b4a). The patch also carries a Cc: stable
tag, so it should be backported to supported stable series in due
course.

Once you get a chance to run a 7.4-rc or newer kernel (or a stable
release containing the backport), it would be great if you could
confirm the fix. If everything looks good, this bug can be closed
as RESOLVED CODE_FIX.

Thanks again for the clear report - pointing out the dwc3 precedent
made this straightforward to fix.

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug 219977] usb: dwc2: memory leak of hsotg->regset
  2025-04-03  8:49 [Bug 219977] New: usb: dwc2: memory leak of hsotg->regset bugzilla-daemon
  2026-08-10  7:10 ` [Bug 219977] " bugzilla-daemon
  2026-11-16  2:37 ` bugzilla-daemon
@ 2026-11-16  5:01 ` bugzilla-daemon
  2 siblings, 0 replies; 4+ messages in thread
From: bugzilla-daemon @ 2026-11-16  5:01 UTC (permalink / raw)
  To: linux-usb

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

--- Comment #3 from kakapapa2@gmail.com ---
Hi Wei Huang,

Thank you for looking into this and providing the fix.
It looks great to me.

Thank you!

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-11-16  5:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-03  8:49 [Bug 219977] New: usb: dwc2: memory leak of hsotg->regset bugzilla-daemon
2026-08-10  7:10 ` [Bug 219977] " bugzilla-daemon
2026-11-16  2:37 ` bugzilla-daemon
2026-11-16  5:01 ` bugzilla-daemon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox