[Devel] [PATCH] mqueue: sys_mq_open: do not call mnt_drop_write() if read-only

Vladimir Davydov vdavydov at parallels.com
Tue Mar 19 02:31:18 PDT 2013


mnt_drop_write() must be called only if mnt_want_write() succeeded,
otherwise the mnt_writers counter will diverge.

Signed-off-by: Vladimir Davydov <vdavydov at parallels.com>
Cc: Doug Ledford <dledford at redhat.com>
Cc: Andrew Morton <akpm at linux-foundation.org>
Cc: KOSAKI Motohiro <kosaki.motohiro at jp.fujitsu.com>
Cc: "Eric W. Biederman" <ebiederm at xmission.com>
---
 ipc/mqueue.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/ipc/mqueue.c b/ipc/mqueue.c
index e5c4f60..3953fda 100644
--- a/ipc/mqueue.c
+++ b/ipc/mqueue.c
@@ -840,7 +840,8 @@ out_putfd:
 		fd = error;
 	}
 	mutex_unlock(&root->d_inode->i_mutex);
-	mnt_drop_write(mnt);
+	if (!ro)
+		mnt_drop_write(mnt);
 out_putname:
 	putname(name);
 	return fd;
-- 
1.7.1




More information about the Devel mailing list