[PATCH] fs: ubifs: fix ubifs_finddir() result check

Heiko Schocher hs at nabladev.com
Thu Jul 9 08:13:36 CEST 2026


Hello Patrick,

On 09.06.26 11:00, Patrick Delaunay wrote:
> ubifs_finddir() can return a negative error code (-ENOMEM or
> PTR_ERR(dent)) and returns 1 when the name is found in the directory.
> Fix the result check accordingly.
> 
> This fixes file existence detection (for "test -e") when U-Boot uses
> UBIFS through ops ubifs_exists(). Since this function is also called
> before other file operations, commands such as "load" could be executed
> on a non-existing file without reporting an error.
> 
> Fixes: 0cab29ff467e ("fs: ubifs: Fix and rework error handling in ubifs_finddir")
> Signed-off-by: Patrick Delaunay <patrick.delaunay at foss.st.com>
> ---
> 
>   fs/ubifs/ubifs.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)

Applied to u-boot-ubi.git

Thanks!

bye,
Heiko
-- 
Nabla Software Engineering
HRB 40522 Augsburg
Phone: +49 821 45592596
E-Mail: office at nabladev.com
Geschäftsführer : Stefano Babic


More information about the U-Boot mailing list