Skip to contentSkip to conversation

hfs: add a check for hfs_bnode_find

PATCH In review Chuhong Yuan 1 participant 1 message Oct 16, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 hfs: add a check for hfs_bnode_find

hfs_brec_update_parent misses a check for hfs_bnode_find and may miss the failure.
Add a check for it like what is done in again.

---
 fs/hfs/brec.c | 2 ++
 1 file changed, 2 insertions(+)
fs/hfs/brec.c +2 -0
index 896396554bcc..e6af05a4cd1b 100644
@@ -430,6 +430,8 @@ static int hfs_brec_update_parent(struct hfs_find_data *fd)
 			new_node->parent = tree->root;
 		}
 		fd->bnode = hfs_bnode_find(tree, new_node->parent);
+		if (IS_ERR(fd->bnode))
+			return PTR_ERR(fd->bnode);
 		/* create index key and entry */
 		hfs_bnode_read_key(new_node, fd->search_key, 14);
 		cnid = cpu_to_be32(new_node->this);
Signature · 1 line
2.20.1