U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Mattijs Korpershoek <mkorpershoek@baylibre.com>
To: Zixun LI <admin@hifiphile.com>
Cc: Marek Vasut <marex@denx.de>, Lukasz Majewski <lukma@denx.de>,
	Tom Rini <trini@konsulko.com>,
	u-boot@lists.denx.de
Subject: Re: usb:composite: data abort on second ums launch
Date: Thu, 27 Mar 2025 14:46:19 +0100	[thread overview]
Message-ID: <8734eya8no.fsf@baylibre.com> (raw)
In-Reply-To: <87sen2pbsl.fsf@baylibre.com>

Hi Zixun, Marek,

On lun., mars 24, 2025 at 18:40, Mattijs Korpershoek <mkorpershoek@baylibre.com> wrote:

> Hi Zixun,
>
> On lun., mars 24, 2025 at 18:33, Zixun LI <admin@hifiphile.com> wrote:
>
> resetting ...

[...]

>
>>
>> Each time when ums is called 2*FSG_BUFLEN, 256kB buffer is allocated
>> and it seems not
>> freed as fsg_common_release() is not called.

There are quite a few things that are wrong in
drivers/usb/gadget/f_mass_storage.c

1. The "Synchronous Abort" exception happens because we call
   kfree(common->luns); and common->luns is not allocated via
   malloc/kmalloc.

2. We use a kref member that's unused and can be removed

3. There is a memory leak (as reported by Zixun) when unbind() is
   called. We should call fsg_common_release().

I will send a series to fix this.

Zixun, thanks again for reporting this and helping me reproduce!

Mattijs

>>
>> Zixun

  reply	other threads:[~2025-03-27 13:46 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-24 10:42 usb:composite: data abort on second ums launch Zixun LI
2025-03-24 14:03 ` Marek Vasut
2025-03-24 15:18   ` Zixun LI
2025-03-24 17:21   ` Mattijs Korpershoek
2025-03-24 17:33     ` Zixun LI
2025-03-24 17:40       ` Mattijs Korpershoek
2025-03-27 13:46         ` Mattijs Korpershoek [this message]
2025-03-28  8:20           ` Mattijs Korpershoek

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=8734eya8no.fsf@baylibre.com \
    --to=mkorpershoek@baylibre.com \
    --cc=admin@hifiphile.com \
    --cc=lukma@denx.de \
    --cc=marex@denx.de \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    /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