Bug 265147 - bhnd: fix potential resource leak in bhnd_usb_attach()
Summary: bhnd: fix potential resource leak in bhnd_usb_attach()
Status: Open
Alias: None
Product: Base System
Classification: Unclassified
Component: wireless (show other bugs)
Version: Unspecified
Hardware: Any Any
: --- Affects Some People
Assignee: freebsd-wireless (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-07-11 07:58 UTC by niejianglei2021@163.com
Modified: 2023-12-28 11:26 UTC (History)
2 users (show)

See Also:


Attachments
a possible patch (1.09 KB, patch)
2022-07-11 07:58 UTC, niejianglei2021@163.com
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description niejianglei2021@163.com 2022-07-11 07:58:33 UTC
Created attachment 235186 [details]
a possible patch

bhnd_usb_attach() allocates PMU for dev with bhnd_alloc_pmu(). When
bhnd_request_ext_rsrc() fails, relevant resource is not released, which
will lead to a resource leak.

We should release the relevant resource with bhnd_release_pmu() when
bhnd_request_ext_rsrc() fails to avoid the resource leak.
Comment 1 Michael Zhilin freebsd_committer freebsd_triage 2022-07-11 09:53:43 UTC
Thank you for your proposal! 

Quick question - what is your hardware model to reproduce defect?
Comment 2 niejianglei2021@163.com 2022-07-13 01:36:24 UTC
(In reply to Michael Zhilin from comment #1)
static analysis
Comment 3 Mark Linimon freebsd_committer freebsd_triage 2023-12-28 11:26:32 UTC
Comment on attachment 235186 [details]
a possible patch

^Triage: convert this to text/plain and set the Patch flag so that the automation can see it.