From: Viacheslav Dubeyko Date: Fri, 3 Apr 2026 23:05:53 +0000 (-0700) Subject: hfsplus: fix error processing issue in hfs_bmap_free() X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=cd3901f4c0348da84f33b6b6e3e8e9aa7e441d01;p=thirdparty%2Fkernel%2Flinux.git 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 cc: John Paul Adrian Glaubitz cc: Yangtao Li cc: linux-fsdevel@vger.kernel.org Signed-off-by: Viacheslav Dubeyko Link: https://lore.kernel.org/r/20260403230556.614171-3-slava@dubeyko.com Signed-off-by: Viacheslav Dubeyko --- diff --git a/fs/hfsplus/btree.c b/fs/hfsplus/btree.c index f1ed7c3365939..80aa816ae1c02 100644 --- a/fs/hfsplus/btree.c +++ b/fs/hfsplus/btree.c @@ -146,8 +146,9 @@ struct hfs_bmap_ctx { * Returns the struct page pointer, or an ERR_PTR on failure. * Note: The caller is responsible for mapping/unmapping the returned page. */ -static struct page *hfs_bmap_get_map_page(struct hfs_bnode *node, struct hfs_bmap_ctx *ctx, - u32 byte_offset) +static struct page *hfs_bmap_get_map_page(struct hfs_bnode *node, + struct hfs_bmap_ctx *ctx, + u32 byte_offset) { u16 rec_idx, off16; unsigned int page_off; @@ -647,9 +648,12 @@ void hfs_bmap_free(struct hfs_bnode *node) res = hfs_bmap_clear_bit(node, nidx); if (res == -EINVAL) { - pr_crit("trying to free free bnode %u(%d)\n", - node->this, node->type); - } else if (!res) { + pr_crit("trying to free the freed bnode %u(%d)\n", + nidx, node->type); + } else if (res) { + pr_crit("fail to free bnode %u(%d)\n", + nidx, node->type); + } else { tree->free_nodes++; mark_inode_dirty(tree->inode); }