From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-f66.google.com ([209.85.221.66]:40192 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725885AbeHSPoi (ORCPT ); Sun, 19 Aug 2018 11:44:38 -0400 Received: by mail-wr1-f66.google.com with SMTP id n2-v6so245422wrw.7 for ; Sun, 19 Aug 2018 05:33:18 -0700 (PDT) From: Amir Goldstein To: Jan Kara Cc: linux-fsdevel@vger.kernel.org Subject: [PATCH] fsnotify: fix false positive warning on inode delete Date: Sun, 19 Aug 2018 15:35:06 +0300 Message-Id: <1534682106-26538-1-git-send-email-amir73il@gmail.com> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: Reported-and-tested-by: syzbot+c34692a51b9a6ca93540@syzkaller.appspotmail.com Fixes: 3ac70bfcde81 ("fsnotify: add helper to get mask from connector") Signed-off-by: Amir Goldstein --- Jan, syzbot reported (in private email) that the reproducer did not trigger the warning, so added tested-by. Thanks, Amir. fs/notify/mark.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/fs/notify/mark.c b/fs/notify/mark.c index 05506d60131c..d559a8ffe7ed 100644 --- a/fs/notify/mark.c +++ b/fs/notify/mark.c @@ -236,6 +236,13 @@ void fsnotify_put_mark(struct fsnotify_mark *mark) if (hlist_empty(&conn->list)) { inode = fsnotify_detach_connector_from_object(conn); free_conn = true; + } else if (conn->type == FSNOTIFY_OBJ_TYPE_DETACHED) { + /* + * fsnotify_destroy_marks() detaches conn from object before + * put on last mark of object list and other marks on the list + * may still have elevated refcounts. We don't need to recalc + * mask nor to free_conn in that case. + */ } else { __fsnotify_recalc_mask(conn); } -- 2.7.4