Bug 265146 - bhnd: fix potential resource leak in bhnd_pmu_core_attach()
Summary: bhnd: fix potential resource leak in bhnd_pmu_core_attach()
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: Unspecified
Hardware: Any Any
: --- Affects Many People
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-07-11 07:56 UTC by niejianglei2021@163.com
Modified: 2022-07-17 17:22 UTC (History)
1 user (show)

See Also:


Attachments
a possible patch (1.40 KB, patch)
2022-07-11 07:57 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:56:24 UTC
bhnd_pmu_core_attach() allocates resource with bhnd_alloc_resource_any()
and bhnd_alloc_pmu(). When some error occurs in this funciton, some
relevant resource is not released, which will lead to a resource leak.

We should release the relevant relevant with bhnd_release_resource() and
bhnd_release_pmu() on the error path to avoid the resource leak.
Comment 1 niejianglei2021@163.com 2022-07-11 07:57:04 UTC
Created attachment 235185 [details]
a possible patch