Skip to contentSkip to conversation

fw_env: Add missing write failure check

PATCH New Alex Kiernan 2 participants 2 messages Jun 12, 2019 – Jun 21, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fw_env: Add missing write failure check

If flash_write fails, whilst we propagate this up to our caller, we need to avoid swapping in the new file (if we're on a filesystem) in this case.

Fixes dbc34323796b ("tools: env: Implement atomic replace for filesystem")

---

 tools/env/fw_env.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/env/fw_env.c +1 -1
index cfada0ee1157..eef12dd2b757 100644
@@ -1317,7 +1317,7 @@ static int flash_io_write(int fd_current)
 			rc = -1;
 		}
 
-		if (target_temp) {
+		if (rc >= 0 && target_temp) {
 			int dir_fd;
 
 			dir_fd = open(dname, O_DIRECTORY | O_RDONLY);
Signature · 1 line
2.17.1
#1 lore raw

PATCH 1/1 fw_env: Add missing write failure check

Quoted 6 lines · Alex Kiernan

If flash_write fails, whilst we propagate this up to our caller, we need to avoid swapping in the new file (if we're on a filesystem) in this case.

Fixes dbc34323796b ("tools: env: Implement atomic replace for filesystem")

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190620/c23e3e48/attachment.sig>