Skip to content

Commit 4396a73

Browse files
amir73iltorvalds
authored andcommitted
fsnotify: fix sb_connectors leak
Fix a leak in s_fsnotify_connectors counter in case of a race between concurrent add of new fsnotify mark to an object. The task that lost the race fails to drop the counter before freeing the unused connector. Following umount() hangs in fsnotify_sb_delete()/wait_var_event(), because s_fsnotify_connectors never drops to zero. Fixes: ec44610 ("fsnotify: count all objects with attached connectors") Reported-by: Murphy Zhou <[email protected]> Link: https://lore.kernel.org/linux-fsdevel/[email protected]/ Signed-off-by: Amir Goldstein <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent bf9f243 commit 4396a73

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

fs/notify/mark.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -531,6 +531,7 @@ static int fsnotify_attach_connector_to_object(fsnotify_connp_t *connp,
531531
/* Someone else created list structure for us */
532532
if (inode)
533533
fsnotify_put_inode_ref(inode);
534+
fsnotify_put_sb_connectors(conn);
534535
kmem_cache_free(fsnotify_mark_connector_cachep, conn);
535536
}
536537

0 commit comments

Comments
 (0)