mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Hugh Dickins <hughd@google.com>
To: Jan Kara <jack@suse.cz>
Cc: Andrew Morton <akpm@linux-foundation.org>, linux-kernel@vger.kernel.org
Subject: [PATCH mmotm/next] fanotify: fix corruption preventing startup
Date: Sat, 11 Jan 2014 22:54:15 -0800 (PST)	[thread overview]
Message-ID: <alpine.LSU.2.11.1401112245290.4960@eggly.anvils> (raw)

Two of my machines couldn't boot mmotm with fanotify enabled:
0x40000020 was being or'ed into a group's notification_waitq next
pointer, with sad results.  It comes from an over-simplification in
fanotify_merge(): test_event isn't NULL when the loop finds no merge.

Signed-off-by: Hugh Dickins <hughd@google.com>
---
Fixes fsnotify-do-not-share-events-between-notification-groups.patch

 fs/notify/fanotify/fanotify.c |    9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

--- mmotm/fs/notify/fanotify/fanotify.c	2014-01-10 18:25:01.700448941 -0800
+++ linux/fs/notify/fanotify/fanotify.c	2014-01-11 22:15:31.580961010 -0800
@@ -37,16 +37,19 @@ static bool should_merge(struct fsnotify
 static struct fsnotify_event *fanotify_merge(struct list_head *list,
 					     struct fsnotify_event *event)
 {
-	struct fsnotify_event *test_event = NULL;
+	struct fsnotify_event *test_event;
+	bool do_merge = false;
 
 	pr_debug("%s: list=%p event=%p\n", __func__, list, event);
 
 	list_for_each_entry_reverse(test_event, list, list) {
-		if (should_merge(test_event, event))
+		if (should_merge(test_event, event)) {
+			do_merge = true;
 			break;
+		}
 	}
 
-	if (!test_event)
+	if (!do_merge)
 		return NULL;
 
 	test_event->mask |= event->mask;

             reply	other threads:[~2014-01-12  6:54 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-12  6:54 Hugh Dickins [this message]
2014-01-13  6:04 ` Jan Kara

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=alpine.LSU.2.11.1401112245290.4960@eggly.anvils \
    --to=hughd@google.com \
    --cc=akpm@linux-foundation.org \
    --cc=jack@suse.cz \
    --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

all inboxes | Powered by JetHome®