[PATCH 1/1] fs/fat: correct handling of full directory

12 Jul
2022
12 Jul
'22
9:56 p.m.
If fat_create_dir_entry() fails, e.g. if the root directory is full, file_fat_write_at() must not try to write the file.
Fixes: 10abea4f851a ("fs: fat: carve out fat_create_dir_entry()") Signed-off-by: Heinrich Schuchardt xypron.glpk@gmx.de --- fs/fat/fat_write.c | 5 +++++ 1 file changed, 5 insertions(+)
diff --git a/fs/fat/fat_write.c b/fs/fat/fat_write.c index a25b2283d4..ee28ca5f14 100644 --- a/fs/fat/fat_write.c +++ b/fs/fat/fat_write.c @@ -1428,6 +1428,11 @@ int file_fat_write_at(const char *filename, loff_t pos, void *buffer, }
ret = fat_create_dir_entry(itr, basename, size, ATTR_ARCH); + if (ret < 0) { + log_err("Can't create directory entry\n"); + ret = -EIO; + goto exit; + }
retdent = itr->dent; } -- 2.30.2
1033
Age (days ago)
1033
Last active (days ago)
0 comments
1 participants
participants (1)
-
Heinrich Schuchardt