erofs-utils: bail out properly if erofs_iget_from_path(root) fails
PATCH 1/1 erofs-utils: bail out properly if erofs_iget_from_path(root) fails
Or "Segmentation fault" can happen if errors are passed into erofs_igrab().
Fixes 21d84349e79a ("erofs-utils: rearrange on-disk metadata")
Signed-off-by Gao Xiang <[email protected]>
--- lib/inode.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
lib/inode.c +2 -1
@@ -1228,10 +1228,11 @@ struct erofs_inode *erofs_mkfs_build_tree_from_path(const char *path)LIST_HEAD (dirs);struct erofs_inode *inode, *root, *parent; - root =erofs_igrab (erofs_iget_from_path (path, true)); + root =erofs_iget_from_path (path, true);if (IS_ERR (root))return root; + (void )erofs_igrab (root); root->i_parent = root;/* rootdir mark */ root->subdirs_queued =1 ;list_add (&root->i_subdirs, &dirs);
Signature · 1 line
2.24.4