[U-Boot] [PATCH] fs: ext4: fix symlink read function

Simon Glass sjg at chromium.org
Tue Sep 8 05:56:07 CEST 2015


Hi Gary,

On 7 September 2015 at 03:20, Gary Bisson
<gary.bisson at boundarydevices.com> wrote:
> Since last API changes for files >2GB, the read of symlink is broken as
> ext4fs_read_file now returns 0 instead of the length of the actual read.
>
> Signed-off-by: Gary Bisson <gary.bisson at boundarydevices.com>
> ---
> Hi all,
>
> Switching from an old v2014.07 to v2015.07 we've noticed that we couldn't
> read symlinks any more. This is due to the API changes made to
> ext4fs_read_file (commit 9f12cd0).
>
> This patch makes the read symlink check both for errors (status < 0) and
> actual read length.
>
> Regards,
> Gary

Thanks for fixing this. Does the filesystem test (test/fs-test.sh)
show this error? How could we enhance the test to detect this?

> ---
>  fs/ext4/ext4_common.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/ext4/ext4_common.c b/fs/ext4/ext4_common.c
> index cab5465..e2ab145 100644
> --- a/fs/ext4/ext4_common.c
> +++ b/fs/ext4/ext4_common.c
> @@ -2040,7 +2040,7 @@ static char *ext4fs_read_symlink(struct ext2fs_node *node)
>                 status = ext4fs_read_file(diro, 0,
>                                            __le32_to_cpu(diro->inode.size),
>                                            symlink, &actread);
> -               if (status == 0) {
> +               if ((status < 0) || (actread == 0)) {
>                         free(symlink);
>                         return 0;
>                 }
> --
> 2.5.1
>

Regards,
Simon


More information about the U-Boot mailing list