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 <shardul.b@mpiricsoftware.com>
cc: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
cc: Yangtao Li <frank.li@vivo.com>
cc: linux-fsdevel@vger.kernel.org
Signed-off-by: Viacheslav Dubeyko <slava@dubeyko.com>
Link: https://lore.kernel.org/r/20260403230556.614171-3-slava@dubeyko.com
Signed-off-by: Viacheslav Dubeyko <slava@dubeyko.com>
This commit is contained in:
Viacheslav Dubeyko
2026-04-03 16:05:53 -07:00
parent 6dca66d7ba
commit cd3901f4c0

View File

@@ -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);
}