summaryrefslogtreecommitdiff
path: root/include/linux/pps_kernel.h
diff options
context:
space:
mode:
authorShardul Bankar <shardul.b@mpiricsoftware.com>2025-12-30 02:19:38 +0530
committerViacheslav Dubeyko <slava@dubeyko.com>2026-01-06 12:40:49 -0800
commitd8a73cc46c8462a969a7516131feb3096f4c49d3 (patch)
treec7a478a4d7bd5cc4841ef1df42aec823f223a440 /include/linux/pps_kernel.h
parentb226804532a875c10276168dc55ce752944096bd (diff)
hfsplus: return error when node already exists in hfs_bnode_create
When hfs_bnode_create() finds that a node is already hashed (which should not happen in normal operation), it currently returns the existing node without incrementing its reference count. This causes a reference count inconsistency that leads to a kernel panic when the node is later freed in hfs_bnode_put(): kernel BUG at fs/hfsplus/bnode.c:676! BUG_ON(!atomic_read(&node->refcnt)) This scenario can occur when hfs_bmap_alloc() attempts to allocate a node that is already in use (e.g., when node 0's bitmap bit is incorrectly unset), or due to filesystem corruption. Returning an existing node from a create path is not normal operation. Fix this by returning ERR_PTR(-EEXIST) instead of the node when it's already hashed. This properly signals the error condition to callers, which already check for IS_ERR() return values. Reported-by: syzbot+1c8ff72d0cd8a50dfeaa@syzkaller.appspotmail.com Link: https://syzkaller.appspot.com/bug?extid=1c8ff72d0cd8a50dfeaa Link: https://lore.kernel.org/all/784415834694f39902088fa8946850fc1779a318.camel@ibm.com/ Fixes: 634725a92938 ("[PATCH] hfs: cleanup HFS+ prints") Signed-off-by: Shardul Bankar <shardul.b@mpiricsoftware.com> Reviewed-by: Viacheslav Dubeyko <slava@dubeyko.com> Signed-off-by: Viacheslav Dubeyko <slava@dubeyko.com> Link: https://lore.kernel.org/r/20251229204938.1907089-1-shardul.b@mpiricsoftware.com Signed-off-by: Viacheslav Dubeyko <slava@dubeyko.com>
Diffstat (limited to 'include/linux/pps_kernel.h')
0 files changed, 0 insertions, 0 deletions