mirror of
https://github.com/u-boot/u-boot.git
synced 2025-04-21 04:14:34 +00:00
ubifs: Call ubifs_iput when ubifs_iget is used
The inode should be freed after a reference is get to avoid memory leak Tested-by: Alexander Dahl <ada@thorsis.com> Link: https://lore.kernel.org/u-boot/b698ec3e-d857-6512-8cc9-4edcab0a41b9@denx.de/T/#t Link: https://lore.kernel.org/all/8f3a7059-6330-f332-8e9f-729b853e001e@denx.de/T/ Co-developed-by: Heiko Schocher <hs@denx.de> Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
This commit is contained in:
parent
cf7ea719ce
commit
d16bda85ff
2 changed files with 7 additions and 3 deletions
|
@ -2324,6 +2324,7 @@ static int ubifs_fill_super(struct super_block *sb, void *data, int silent)
|
||||||
goto out_umount;
|
goto out_umount;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
ubifs_iput(root);
|
||||||
sb->s_root = NULL;
|
sb->s_root = NULL;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -319,9 +319,7 @@ static int filldir(struct ubifs_info *c, const char *name, int namlen,
|
||||||
}
|
}
|
||||||
ctime_r((time_t *)&inode->i_mtime, filetime);
|
ctime_r((time_t *)&inode->i_mtime, filetime);
|
||||||
printf("%9lld %24.24s ", inode->i_size, filetime);
|
printf("%9lld %24.24s ", inode->i_size, filetime);
|
||||||
#ifndef __UBOOT__
|
|
||||||
ubifs_iput(inode);
|
ubifs_iput(inode);
|
||||||
#endif
|
|
||||||
|
|
||||||
printf("%s\n", name);
|
printf("%s\n", name);
|
||||||
|
|
||||||
|
@ -557,6 +555,7 @@ static unsigned long ubifs_findfile(struct super_block *sb, char *filename)
|
||||||
|
|
||||||
/* We have some sort of symlink recursion, bail out */
|
/* We have some sort of symlink recursion, bail out */
|
||||||
if (symlink_count++ > 8) {
|
if (symlink_count++ > 8) {
|
||||||
|
ubifs_iput(inode);
|
||||||
printf("Symlink recursion, aborting\n");
|
printf("Symlink recursion, aborting\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -568,6 +567,7 @@ static unsigned long ubifs_findfile(struct super_block *sb, char *filename)
|
||||||
* the leading slash */
|
* the leading slash */
|
||||||
next = name = link_name + 1;
|
next = name = link_name + 1;
|
||||||
root_inum = 1;
|
root_inum = 1;
|
||||||
|
ubifs_iput(inode);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
/* Relative to cur dir */
|
/* Relative to cur dir */
|
||||||
|
@ -575,6 +575,7 @@ static unsigned long ubifs_findfile(struct super_block *sb, char *filename)
|
||||||
link_name, next == NULL ? "" : next);
|
link_name, next == NULL ? "" : next);
|
||||||
memcpy(symlinkpath, buf, sizeof(buf));
|
memcpy(symlinkpath, buf, sizeof(buf));
|
||||||
next = name = symlinkpath;
|
next = name = symlinkpath;
|
||||||
|
ubifs_iput(inode);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -583,8 +584,10 @@ static unsigned long ubifs_findfile(struct super_block *sb, char *filename)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Found the node! */
|
/* Found the node! */
|
||||||
if (!next || *next == '\0')
|
if (!next || *next == '\0') {
|
||||||
|
ubifs_iput(inode);
|
||||||
return inum;
|
return inum;
|
||||||
|
}
|
||||||
|
|
||||||
root_inum = inum;
|
root_inum = inum;
|
||||||
name = next;
|
name = next;
|
||||||
|
|
Loading…
Add table
Reference in a new issue