[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20101210174429.GB32555@lsanfilippo.unix.rd.tt.avira.com>
Date:	Fri, 10 Dec 2010 18:44:29 +0100
From:	Lino Sanfilippo <LinoSanfilippo@....de>
To:	eparis@...hat.com
Cc:	tvrtko.ursulin@...hos.com, linux-kernel@...r.kernel.org,
	linux-fsdevel@...r.kernel.org
Subject: [PATCH 1/2] fanotify: fix broken ref count in create_fd()
In create_fd(), before we fallback to open a file read-only we should grab dentry
and mount refs again, since they have been put by the former failed call to dentry_open().
Signed-off-by: Lino Sanfilippo <LinoSanfilippo@....de>
---
 fs/notify/fanotify/fanotify_user.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
 Please apply this against commit 26552d4aa4117cd3ea8cbe13ebf317da652e6bfd of
 branch 'origin/for-next' from git.infradead.org/users/eparis/notify.git
diff --git a/fs/notify/fanotify/fanotify_user.c b/fs/notify/fanotify/fanotify_user.c
index 2d4925b..e108960 100644
--- a/fs/notify/fanotify/fanotify_user.c
+++ b/fs/notify/fanotify/fanotify_user.c
@@ -92,6 +92,10 @@ static int create_fd(struct fsnotify_group *group, struct fsnotify_event *event)
 		 * in order to at least provide something to the listener.
 		 */
 		if (IS_ERR(new_file) && group->fanotify_data.readonly_fallback) {
+			/* dentry_open() put our refs, so get them again... */
+			dentry = dget(event->path.dentry);
+			mnt = mntget(event->path.mnt);
+
 			flags &= ~O_ACCMODE;
 			flags |= O_RDONLY;
 			new_file = dentry_open(dentry, mnt, flags,
-- 
1.5.6.5
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/
Powered by blists - more mailing lists
 
