Hi Heinrich, On Wed, 15 Nov 2023 at 18:25, Heinrich Schuchardt <xypron.g...@gmx.de> wrote: > > On 11/15/23 23:46, Heinrich Schuchardt wrote: > > > > > > Am 15. November 2023 23:15:46 MEZ schrieb Simon Glass <s...@chromium.org>: > >> Hi Shantur, > >> > >> On Wed, 15 Nov 2023 at 15:13, Shantur Rathore <i...@shantur.com> wrote: > >>> > >>> Hi Simon, > >>> > >>> I have figured out the cause of the crash. > >>> It happens here - > >>> https://github.com/u-boot/u-boot/blob/master/boot/bootflow.c#L470 > >>> while doing - free(bflow->buf) > > Unfortunately the description of the field bflow->buf is deceptively wrong: > > @buf: Bootflow file contents (allocated) > > The EFI bootflow never allocates this buffer but uses the address > $kernel_addr_r without allocation. > > We must not call free on an address that we never allocated via malloc(). > > Doesn't this also explain the error you experienced before writing > > [PATCH v4 05/12] usb: Avoid unbinding devices in use by bootflows > https://lore.kernel.org/u-boot/cahc5_t3v23k_xbws5o-g9iqfoq7fhpkscf89xdaaago+bu8...@mail.gmail.com/T/#m992e20fb25fe0f2f0047e901a76e78628e59da7a
Yes that is indeed the bug report from Shantur. I just sent a patch. I still would like the USB patch to go in though, as it is wrong to unbind devices before boot. We have a special device_remove() flag for handling this and it should be used with all devices, including USB. [..] Regards, Simon