From: Amy Griffis <amy.griffis@hp.com>
To: linux-kernel@vger.kernel.org
Cc: John McCutchan <john@johnmccutchan.com>, Robert Love <rlove@rlove.org>
Subject: [PATCH] fix NULL dereference in inotify_ignore
Date: Sat, 20 May 2006 00:45:17 -0400 [thread overview]
Message-ID: <20060520044517.GA6878@zk3.dec.com> (raw)
Don't reassign to watch. If idr_find() returns NULL, then
put_inotify_watch will choke.
Signed-off-by: Amy Griffis <amy.griffis@hp.com>
diff --git a/fs/inotify.c b/fs/inotify.c
index 7d57253..5d4ba7c 100644
--- a/fs/inotify.c
+++ b/fs/inotify.c
@@ -889,18 +889,17 @@ static int inotify_ignore(struct inotify
get_inotify_watch(watch);
inode = watch->inode;
mutex_unlock(&dev->mutex);
mutex_lock(&inode->inotify_mutex);
mutex_lock(&dev->mutex);
/* make sure that we did not race */
- watch = idr_find(&dev->idr, wd);
- if (likely(watch))
+ if (likely(idr_find(&dev->idr, wd) == watch))
remove_watch(watch, dev);
mutex_unlock(&dev->mutex);
mutex_unlock(&inode->inotify_mutex);
put_inotify_watch(watch);
return 0;
}
reply other threads:[~2006-05-20 4:45 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20060520044517.GA6878@zk3.dec.com \
--to=amy.griffis@hp.com \
--cc=john@johnmccutchan.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rlove@rlove.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