Re: [PATCH] usb: gadget: midi2: remove default configfs groups on teardown

Joshua Crofts <[email protected]> Mon, 3 Aug 2026 07:59:17 +0200
Newsgroups org.kernel.vger.linux-usb,org.kernel.vger.linux-kernel,org.kernel.vger.stable
Message-ID <CALoEA-yuzdD9=gBy0s0VFc2yD5Kwga57LjECUWTTXdF2SHed8g@mail.gmail.com>
On Thu, 30 Jul 2026 at 15:58, Joshua Crofts <[email protected]> wrote:
>
> f_midi2_alloc_inst() creates default configfs child groups for the
> default endpoint and default block using configfs_add_default_group(),
> setting their internal refcount to 1.
>
> However, during function teardown in f_midi2_free_inst() or EP cleanup
> in f_midi2_ep_opts_release(), configfs_remove_default_groups() is
> never called, therefore never dropping the refcount and leaking struct
> f_midi2_ep_opts and f_midi2_block_opts.
>
> Add the missing configfs_remove_default_groups() in the afformentioned
> functions to free the structs properly.
>
> Fixes: 8b645922b223 ("usb: gadget: Add support for USB MIDI 2.0 function driver")
> Cc: <[email protected]>
> Reported-by: [email protected]
> Closes: https://syzkaller.appspot.com/bug?extid=eaa106d192c9daf37f95
> Tested-by: [email protected]
> Signed-off-by: Joshua Crofts <[email protected]>
> ---
> Aside from testing the fix locally with QEMU and the reproducer,
> syzbot also reports no issues after running `syz test`.
> ---

Hi Greg,

Gentle ping on this patch.

Kind regards,
Joshua Crofts