Skip to content

Commit cd3901f

Browse files
committed
hfsplus: fix error processing issue in hfs_bmap_free()
Currently, we check only -EINVAL error code in hfs_bmap_free() after calling the hfs_bmap_clear_bit(). It means that other error codes will be silently ignored. This patch adds the checking of all other error codes. cc: Shardul Bankar <[email protected]> cc: John Paul Adrian Glaubitz <[email protected]> cc: Yangtao Li <[email protected]> cc: [email protected] Signed-off-by: Viacheslav Dubeyko <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Viacheslav Dubeyko <[email protected]>
1 parent 6dca66d commit cd3901f

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

fs/hfsplus/btree.c

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,9 @@ struct hfs_bmap_ctx {
146146
* Returns the struct page pointer, or an ERR_PTR on failure.
147147
* Note: The caller is responsible for mapping/unmapping the returned page.
148148
*/
149-
static struct page *hfs_bmap_get_map_page(struct hfs_bnode *node, struct hfs_bmap_ctx *ctx,
150-
u32 byte_offset)
149+
static struct page *hfs_bmap_get_map_page(struct hfs_bnode *node,
150+
struct hfs_bmap_ctx *ctx,
151+
u32 byte_offset)
151152
{
152153
u16 rec_idx, off16;
153154
unsigned int page_off;
@@ -647,9 +648,12 @@ void hfs_bmap_free(struct hfs_bnode *node)
647648

648649
res = hfs_bmap_clear_bit(node, nidx);
649650
if (res == -EINVAL) {
650-
pr_crit("trying to free free bnode %u(%d)\n",
651-
node->this, node->type);
652-
} else if (!res) {
651+
pr_crit("trying to free the freed bnode %u(%d)\n",
652+
nidx, node->type);
653+
} else if (res) {
654+
pr_crit("fail to free bnode %u(%d)\n",
655+
nidx, node->type);
656+
} else {
653657
tree->free_nodes++;
654658
mark_inode_dirty(tree->inode);
655659
}

0 commit comments

Comments
 (0)