[U-Boot] [PATCH] fs: ext4: Unmount FS in do_fs_type()

Simon Glass sjg at chromium.org
Tue Feb 19 15:16:59 UTC 2019


On Wed, 6 Feb 2019 at 06:10, Marek Vasut <marek.vasut at gmail.com> wrote:
>
> Unlike other generic FS accessors, fs_get_info() does not call fs_close()
> at the end of it's operation. Thus, using fs_get_info() in do_fs_type()
> without calling fs_close() causes potential memory leak by creating new
> filesystem structures on each call of do_fs_type().
>
> The test case to trigger this problem is as follows. It is required to
> have ext4 filesystem on the first partition of the SDMMC device, since
> ext4 requires stateful mount and causes memory allocation.
> => while true ; do mmc rescan ; fstype mmc 1 ; done
> Eventually, the mounting of ext4 will fail due to malloc failures
> and the filesystem will not be correctly detected.
>
> This patch fixes the problem by adding the missing fs_close().
>
> Signed-off-by: Marek Vasut <marek.vasut+renesas at gmail.com>
> Cc: Simon Glass <sjg at chromium.org>
> Cc: Tom Rini <trini at konsulko.com>
> ---
>  fs/fs.c | 2 ++
>  1 file changed, 2 insertions(+)
>

Reviewed-by: Simon Glass <sjg at chromium.org>


More information about the U-Boot mailing list