public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: syzbot <syzbot+c679f13773f295d2da53@syzkaller.appspotmail.com>
To: linux-kernel@vger.kernel.org
Subject: Re: [syzbot] Re: [syzbot] [squashfs?] possible deadlock in fsnotify_destroy_mark
Date: Fri, 27 Sep 2024 01:38:40 -0700	[thread overview]
Message-ID: <66f66f10.050a0220.38ace9.0011.GAE@google.com> (raw)
In-Reply-To: <000000000000ae63710620417f67@google.com>

For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org.

***

Subject: Re: [syzbot] [squashfs?] possible deadlock in fsnotify_destroy_mark
Author: lizhi.xu@windriver.com

Use memalloc_nofs_save/memalloc_nofs_restore to make sure we don't end
up with the fs reclaim dependency.

#syz test

diff --git a/fs/notify/inotify/inotify_user.c b/fs/notify/inotify/inotify_user.c
index c7e451d5bd51..70b77b6186a6 100644
--- a/fs/notify/inotify/inotify_user.c
+++ b/fs/notify/inotify/inotify_user.c
@@ -643,8 +643,13 @@ static int inotify_update_watch(struct fsnotify_group *group, struct inode *inod
 	/* try to update and existing watch with the new arg */
 	ret = inotify_update_existing_watch(group, inode, arg);
 	/* no mark present, try to add a new one */
-	if (ret == -ENOENT)
+	if (ret == -ENOENT) {
+		unsigned int nofs_flag;
+
+		nofs_flag = memalloc_nofs_save();
 		ret = inotify_new_watch(group, inode, arg);
+		memalloc_nofs_restore(nofs_flag);
+	}
 	fsnotify_group_unlock(group);
 
 	return ret;

  parent reply	other threads:[~2024-09-27  8:38 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-22  8:32 [syzbot] [squashfs?] possible deadlock in fsnotify_destroy_mark syzbot
2024-09-27  7:00 ` [syzbot] " syzbot
2024-09-27  8:38 ` syzbot [this message]
2024-09-27  9:12 ` [PATCH] inotify: Fix " Lizhi Xu
2024-09-27  9:31   ` Amir Goldstein
2024-09-27 10:20     ` Jan Kara
2024-09-27 13:38       ` [PATCH V2] " Lizhi Xu
2024-09-27 13:59         ` Amir Goldstein
2024-09-27 14:36           ` [PATCH V3] " Lizhi Xu
2024-09-27 14:58             ` Amir Goldstein
2024-10-02 13:23             ` Jan Kara
2024-09-27 14:42 ` [syzbot] Re: [syzbot] [squashfs?] " syzbot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=66f66f10.050a0220.38ace9.0011.GAE@google.com \
    --to=syzbot+c679f13773f295d2da53@syzkaller.appspotmail.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox