summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorStephen Warren <swarren@nvidia.com>2015-09-04 22:03:43 -0600
committerDongjin Kim <tobetter@gmail.com>2020-02-10 22:44:41 +0900
commit6830b129c23cd872c2be81327750f75679004bf4 (patch)
treed376135f53ae3495bb2f1450322ded158877f221 /fs
parent225088520f897ceb02ba0d4413ba3611139feff0 (diff)
downloadu-boot-odroid-c1-6830b129c23cd872c2be81327750f75679004bf4.tar.gz
ext4: avoid calling ext4fs_mount() twice, which leaks
ext4_write_file() is only called from the "fs" layer, which calls both ext4fs_mount() and ext4fs_close() before/after calling ext4_write_file(). Fix ext4_write_file() not to call ext4fs_mount() again, since the mount operation malloc()s some RAM which is leaked when a second mount call over-writes the pointer to that data, if no intervening close call is made. Signed-off-by: Stephen Warren <swarren@nvidia.com> Acked-by: Lukasz Majewski <l.majewski@samsung.com> Tested-by: Lukasz Majewski <l.majewski@samsung.com> Change-Id: Ic90440819d9d373a201455a15974501b659179db
Diffstat (limited to 'fs')
-rw-r--r--fs/ext4/ext4_write.c10
1 files changed, 0 insertions, 10 deletions
diff --git a/fs/ext4/ext4_write.c b/fs/ext4/ext4_write.c
index f61d59d99e..84b983cd92 100644
--- a/fs/ext4/ext4_write.c
+++ b/fs/ext4/ext4_write.c
@@ -1009,27 +1009,17 @@ int ext4_write_file(const char *filename, void *buf, loff_t offset,
return -1;
}
- /* mount the filesystem */
- if (!ext4fs_mount(0)) {
- printf("** Error Bad ext4 partition **\n");
- goto fail;
- }
-
ret = ext4fs_write(filename, buf, len);
-
if (ret) {
printf("** Error ext4fs_write() **\n");
goto fail;
}
- ext4fs_close();
- *actwrite = len;
*actwrite = len;
return 0;
fail:
- ext4fs_close();
*actwrite = 0;
return -1;