projects
/
platform
/
upstream
/
erofs-utils.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
3581777
)
erofs-utils: derive i_srcpath for erofs_rebuild_mkdir()
author
Gao Xiang
<hsiangkao@linux.alibaba.com>
Mon, 24 Jun 2024 11:59:22 +0000
(19:59 +0800)
committer
Gao Xiang
<hsiangkao@linux.alibaba.com>
Mon, 24 Jun 2024 13:08:42 +0000
(21:08 +0800)
Also add missing erofs_iput() on errors.
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
Link:
https://lore.kernel.org/r/20240624115923.4090196-1-hsiangkao@linux.alibaba.com
lib/rebuild.c
patch
|
blob
|
history
diff --git
a/lib/rebuild.c
b/lib/rebuild.c
index 9c1e8f8e10a8d75df2e7a7b1f3d9b67a1e427a14..8b186eb185b3eb6ec54c6045a681327d874ed699 100644
(file)
--- a/
lib/rebuild.c
+++ b/
lib/rebuild.c
@@
-35,6
+35,11
@@
static struct erofs_dentry *erofs_rebuild_mkdir(struct erofs_inode *dir,
if (IS_ERR(inode))
return ERR_CAST(inode);
+ if (asprintf(&inode->i_srcpath, "%s/%s",
+ dir->i_srcpath ? : "", s) < 0) {
+ erofs_iput(inode);
+ return ERR_PTR(-ENOMEM);
+ }
inode->i_mode = S_IFDIR | 0755;
inode->i_parent = dir;
inode->i_uid = getuid();
@@
-44,7
+49,9
@@
static struct erofs_dentry *erofs_rebuild_mkdir(struct erofs_inode *dir,
erofs_init_empty_dir(inode);
d = erofs_d_alloc(dir, s);
- if (!IS_ERR(d)) {
+ if (IS_ERR(d)) {
+ erofs_iput(inode);
+ } else {
d->type = EROFS_FT_DIR;
d->inode = inode;
}