projects
/
GitHub
/
moto-9609
/
android_kernel_motorola_exynos9610.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
d54e880
)
jffs2: fix a memleak in read_direntry()
author
Wei Fang
<fangwei1@huawei.com>
Tue, 29 Sep 2015 03:23:55 +0000
(11:23 +0800)
committer
Brian Norris
<computersforpeace@gmail.com>
Sun, 4 Oct 2015 21:30:50 +0000
(22:30 +0100)
Need to free the memory allocated for 'fd' if failed to read all
of the remainder name.
Signed-off-by: Wei Fang <fangwei1@huawei.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
fs/jffs2/readinode.c
patch
|
blob
|
blame
|
history
diff --git
a/fs/jffs2/readinode.c
b/fs/jffs2/readinode.c
index 28e0aab42bc34f6a26f67b82bc3f8c94a9bf4232..bfebbf13698c0e0d255e20f5ebf26de7fd6b5845 100644
(file)
--- a/
fs/jffs2/readinode.c
+++ b/
fs/jffs2/readinode.c
@@
-660,8
+660,12
@@
static inline int read_direntry(struct jffs2_sb_info *c, struct jffs2_raw_node_r
err = jffs2_flash_read(c, (ref_offset(ref)) + read,
rd->nsize - already, &read, &fd->name[already]);
- if (unlikely(read != rd->nsize - already) && likely(!err))
+ if (unlikely(read != rd->nsize - already) && likely(!err)) {
+ jffs2_free_full_dirent(fd);
+ JFFS2_ERROR("short read: wanted %d bytes, got %zd\n",
+ rd->nsize - already, read);
return -EIO;
+ }
if (unlikely(err)) {
JFFS2_ERROR("read remainder of name: error %d\n", err);