u-boot.lists.denx.de archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] fs/fat: correct handling of full directory
@ 2022-07-12 19:56 Heinrich Schuchardt
  0 siblings, 0 replies; only message in thread
From: Heinrich Schuchardt @ 2022-07-12 19:56 UTC (permalink / raw)
  To: u-boot; +Cc: AKASHI Takahiro, Heinrich Schuchardt

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


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2022-07-12 19:57 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-12 19:56 [PATCH 1/1] fs/fat: correct handling of full directory Heinrich Schuchardt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).