[Bug 265147] bhnd: fix potential resource leak in bhnd_usb_attach()

From: <bugzilla-noreply_at_freebsd.org>
Date: Mon, 11 Jul 2022 07:58:33 UTC

            Bug ID: 265147
           Summary: bhnd: fix potential resource leak in bhnd_usb_attach()
           Product: Base System
           Version: Unspecified
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Many People
          Priority: ---
         Component: kern
          Assignee: bugs@FreeBSD.org
          Reporter: niejianglei2021@163.com

Created attachment 235186
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=235186&action=edit
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.

You are receiving this mail because:
You are the assignee for the bug.