From: Greg KH <gregkh@linuxfoundation.org>
To: Chaithanya Lagisetty <nagachaithanya9911@gmail.com>
Cc: christophe.jaillet@wanadoo.fr, kees@kernel.org,
linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
syzbot+28cf08dec5895bd562e6@syzkaller.appspotmail.com
Subject: Re: [PATCH RESEND] usb: gadget: f_loopback: fix descriptor leak on unbind
Date: Thu, 10 Sep 2026 18:32:50 +0200 [thread overview]
Message-ID: <2026091028-launder-jockstrap-be0c@gregkh> (raw)
In-Reply-To: <20260902105153.3516793-1-nagachaithanya9911@gmail.com>
On Wed, Sep 02, 2026 at 10:51:53AM +0000, Chaithanya Lagisetty wrote:
> loopback_bind() allocates descriptor copies through
> usb_assign_descriptors(), but f_loopback does not release them during
> the unbind path. On every bind/unbind cycle of the gadget (for example
> by repeatedly writing the UDC attribute through configfs) a new set of
> descriptors is allocated while the previous ones are leaked. syzbot
> reported this via kmemleak:
>
> BUG: memory leak
> unreferenced object 0xffff888016b8f180 (size 64):
> comm "repro", pid 5613
> backtrace:
> __kmalloc_noprof+0x3bf/0x550
> usb_copy_descriptors+0x6c/0x160
> usb_assign_descriptors+0x48/0x180
> loopback_bind+0xff/0x120
> usb_add_function+0xca/0x270
> configfs_composite_bind+0x667/0x9b0
> gadget_bind_driver+0xed/0x390
>
> Move descriptor cleanup to a new loopback_unbind() callback that frees
> them with usb_free_all_descriptors(), matching the lifecycle used by
> other gadget functions such as f_acm. With descriptors released during
> unbind, the usb_free_all_descriptors() call in lb_free_func() becomes
> redundant and can be removed.
>
> Fixes: 10287baec761 ("usb: gadget: always update HS/SS descriptors and create a copy of them")
> Reported-by: syzbot+28cf08dec5895bd562e6@syzkaller.appspotmail.com
> Closes: https://syzkaller.appspot.com/bug?extid=28cf08dec5895bd562e6
How was this tested? I don't see syzbot doing the test, did you?
And did you forget an Assisted-by: tag?
thanks,
greg k-h
next prev parent reply other threads:[~2026-09-10 16:32 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-08 18:15 [PATCH] " Chaithanya Lagisetty
[not found] ` <CALFZYQUzfbVnAhSqR6JmfDB-zvuiGSWx+9tCBc03xfBxJS9h0Q@mail.gmail.com>
2026-08-23 16:56 ` Greg Kroah-Hartman
2026-09-02 10:51 ` [PATCH RESEND] " Chaithanya Lagisetty
2026-09-10 16:32 ` Greg KH [this message]
2026-09-11 9:01 ` Chaithanya Lagisetty
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2026091028-launder-jockstrap-be0c@gregkh \
--to=gregkh@linuxfoundation.org \
--cc=christophe.jaillet@wanadoo.fr \
--cc=kees@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=nagachaithanya9911@gmail.com \
--cc=syzbot+28cf08dec5895bd562e6@syzkaller.appspotmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®