linux-erofs.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 1/1] erofs-utils: fix use after free in closedir
@ 2020-11-27 11:06 Huang Jianan
  2020-11-27 11:10 ` Huang Jianan
  2020-11-27 11:10 ` Gao Xiang
  0 siblings, 2 replies; 4+ messages in thread
From: Huang Jianan @ 2020-11-27 11:06 UTC (permalink / raw)
  To: linux-erofs; +Cc: liufeibao, guoweichao, zhangshiming

No need to closedir _dir again since it has been released.

Signed-off-by: Huang Jianan <huangjianan@oppo.com>
Signed-off-by: Guo Weichao <guoweichao@oppo.com>
---
 lib/inode.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/lib/inode.c b/lib/inode.c
index eb2e0f2..388d21d 100644
--- a/lib/inode.c
+++ b/lib/inode.c
@@ -958,11 +958,11 @@ struct erofs_inode *erofs_mkfs_build_tree(struct erofs_inode *dir)
 
 	ret = erofs_prepare_dir_file(dir);
 	if (ret)
-		goto err_closedir;
+		goto err;
 
 	ret = erofs_prepare_inode_buffer(dir);
 	if (ret)
-		goto err_closedir;
+		goto err;
 
 	if (IS_ROOT(dir))
 		erofs_fixup_meta_blkaddr(dir);
@@ -988,7 +988,7 @@ struct erofs_inode *erofs_mkfs_build_tree(struct erofs_inode *dir)
 fail:
 			d->inode = NULL;
 			d->type = EROFS_FT_UNKNOWN;
-			goto err_closedir;
+			goto err;
 		}
 
 		d->type = erofs_type_by_mode[d->inode->i_mode >> S_SHIFT];
@@ -1003,6 +1003,7 @@ fail:
 
 err_closedir:
 	closedir(_dir);
+err:
 	return ERR_PTR(ret);
 }
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread
* [PATCH v2 1/1] erofs-utils: fix use after free in closedir
@ 2020-11-27 11:03 Huang Jianan
  0 siblings, 0 replies; 4+ messages in thread
From: Huang Jianan @ 2020-11-27 11:03 UTC (permalink / raw)
  To: linux-erofs; +Cc: liufeibao, guoweichao, zhangshiming

No need to closedir _dir again since it has been released.

Signed-off-by: Huang Jianan <huangjianan@oppo.com>
Signed-off-by: Guo Weichao <guoweichao@oppo.com>
---
 lib/inode.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lib/inode.c b/lib/inode.c
index eb2e0f2..2397bc7 100644
--- a/lib/inode.c
+++ b/lib/inode.c
@@ -958,11 +958,11 @@ struct erofs_inode *erofs_mkfs_build_tree(struct erofs_inode *dir)
 
 	ret = erofs_prepare_dir_file(dir);
 	if (ret)
-		goto err_closedir;
+		goto err;
 
 	ret = erofs_prepare_inode_buffer(dir);
 	if (ret)
-		goto err_closedir;
+		goto err;
 
 	if (IS_ROOT(dir))
 		erofs_fixup_meta_blkaddr(dir);
@@ -1003,6 +1003,7 @@ fail:
 
 err_closedir:
 	closedir(_dir);
+err:
 	return ERR_PTR(ret);
 }
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-11-27 11:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-27 11:06 [PATCH v2 1/1] erofs-utils: fix use after free in closedir Huang Jianan
2020-11-27 11:10 ` Huang Jianan
2020-11-27 11:10 ` Gao Xiang
  -- strict thread matches above, loose matches on Subject: below --
2020-11-27 11:03 Huang Jianan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).