]> git.baikalelectronics.ru Git - kernel.git/commit
fsnotify: fix sb_connectors leak
authorAmir Goldstein <amir73il@gmail.com>
Thu, 9 Sep 2021 11:56:34 +0000 (14:56 +0300)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 10 Sep 2021 16:46:48 +0000 (09:46 -0700)
commit61796c694bb6c5b6d0d0736a3cc2e6d935200e2f
tree5bd2044ab9bcf43b128ef914971358ce67adac42
parent3a8db5be4877180b6a90aa92e437c60d9951172e
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: fe1d2cba3fc5 ("fsnotify: count all objects with attached connectors")
Reported-by: Murphy Zhou <jencce.kernel@gmail.com>
Link: https://lore.kernel.org/linux-fsdevel/20210907063338.ycaw6wvhzrfsfdlp@xzhoux.usersys.redhat.com/
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fs/notify/mark.c