Skip to content

Commit d3bc0fa

Browse files
committed
fsnotify: fix false positive warning on inode delete
When inode is getting deleted and someone else holds reference to a mark attached to the inode, we just detach the connector from the inode. In that case fsnotify_put_mark() called from fsnotify_destroy_marks() will decide to recalculate mask for the inode and __fsnotify_recalc_mask() will WARN about invalid connector type: WARNING: CPU: 1 PID: 12015 at fs/notify/mark.c:139 __fsnotify_recalc_mask+0x2d7/0x350 fs/notify/mark.c:139 Actually there's no reason to warn about detached connector in __fsnotify_recalc_mask() so just silently skip updating the mask in such case. Reported-by: syzbot+c34692a51b9a6ca93540@syzkaller.appspotmail.com Fixes: 3ac70bf ("fsnotify: add helper to get mask from connector") Signed-off-by: Jan Kara <jack@suse.cz>
1 parent 2ad0d52 commit d3bc0fa

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

‎fs/notify/mark.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,13 +132,13 @@ static void __fsnotify_recalc_mask(struct fsnotify_mark_connector *conn)
132132
struct fsnotify_mark *mark;
133133

134134
assert_spin_locked(&conn->lock);
135+
/* We can get detached connector here when inode is getting unlinked. */
136+
if (!fsnotify_valid_obj_type(conn->type))
137+
return;
135138
hlist_for_each_entry(mark, &conn->list, obj_list) {
136139
if (mark->flags & FSNOTIFY_MARK_FLAG_ATTACHED)
137140
new_mask |= mark->mask;
138141
}
139-
if (WARN_ON(!fsnotify_valid_obj_type(conn->type)))
140-
return;
141-
142142
*fsnotify_conn_mask_p(conn) = new_mask;
143143
}
144144

0 commit comments

Comments
 (0)