linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] fanotify: fix broken ref count in create_fd()
@ 2010-12-10 17:44 Lino Sanfilippo
  0 siblings, 0 replies; only message in thread
From: Lino Sanfilippo @ 2010-12-10 17:44 UTC (permalink / raw)
  To: eparis; +Cc: tvrtko.ursulin, linux-kernel, linux-fsdevel


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@gmx.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


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2010-12-10 17:46 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-12-10 17:44 [PATCH 1/2] fanotify: fix broken ref count in create_fd() Lino Sanfilippo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).