[PATCH 1/5] misc: fs_loader: fix ubifs not unmounted on dev_get_priv error
Christian Marangi
ansuelsmth at gmail.com
Tue Mar 3 14:43:29 CET 2026
On Tue, Mar 03, 2026 at 01:38:03PM +0000, Daniel Golle wrote:
> On Tue, Mar 03, 2026 at 02:29:08PM +0100, Christian Marangi wrote:
> > When dev_get_priv errors out, the ubifs is not unbounted (if used)
>
> I don't understand why or where UBIFS is being used here.
> Did you mean to say "UBI is not attached"?
> UBI != UBIFS.
>
Function that is not called is umount_ubifs. That calls cmd_ubifs_umount.
unbounted is a typo for unmounted.
Probably the confusion is present already in the FS loader driver where ubi
needed to be used instead of ubifs?
There are mount_ubifs and umount_ubifs but they should have been mount_ubi and
umount_ubi ? But then they use ubifs cmd OPs. I'm a bit confused here.
> >
> > Correctly handle this handle condition and while at it also return -EINVAL
> > instead of -ENOMEM as a better error since no memory is allocated but is
> > actually an invalid scenario for fw_get_filesystem_firmware().
> >
> > Signed-off-by: Christian Marangi <ansuelsmth at gmail.com>
> > ---
> > drivers/misc/fs_loader.c | 6 ++++--
> > 1 file changed, 4 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/misc/fs_loader.c b/drivers/misc/fs_loader.c
> > index 2928cf75f89e..7e432a7ebd62 100644
> > --- a/drivers/misc/fs_loader.c
> > +++ b/drivers/misc/fs_loader.c
> > @@ -178,8 +178,10 @@ static int fw_get_filesystem_firmware(struct udevice *dev)
> >
> > struct firmware *firmwarep = dev_get_priv(dev);
> >
> > - if (!firmwarep)
> > - return -ENOMEM;
> > + if (!firmwarep) {
> > + ret = -EINVAL;
> > + goto out;
> > + }
> >
> > ret = fs_read(firmwarep->name, (ulong)map_to_sysmem(firmwarep->data),
> > firmwarep->offset, firmwarep->size, &actread);
> > --
> > 2.51.0
> >
--
Ansuel
More information about the U-Boot
mailing list