aboutsummaryrefslogtreecommitdiffstats
path: root/ipc
diff options
context:
space:
mode:
authorVladimir Davydov2013-03-22 17:04:51 -0500
committerGreg Kroah-Hartman2013-03-28 14:17:48 -0500
commit6ad6c406dddbca431b5bd86585b085fd005dd87b (patch)
treee14ebd5e9452a654868ed6228c6930a332898068 /ipc
parent463675facf738213758baf2fb501c446274407b9 (diff)
downloadkernel-omap-6ad6c406dddbca431b5bd86585b085fd005dd87b.tar.gz
kernel-omap-6ad6c406dddbca431b5bd86585b085fd005dd87b.tar.xz
kernel-omap-6ad6c406dddbca431b5bd86585b085fd005dd87b.zip
mqueue: sys_mq_open: do not call mnt_drop_write() if read-only
commit 38d78e587d4960d0db94add518d27ee74bad2301 upstream. mnt_drop_write() must be called only if mnt_want_write() succeeded, otherwise the mnt_writers counter will diverge. mnt_writers counters are used to check if remounting FS as read-only is OK, so after an extra mnt_drop_write() call, it would be impossible to remount mqueue FS as read-only. Besides, on umount a warning would be printed like this one: ===================================== [ BUG: bad unlock balance detected! ] 3.9.0-rc3 #5 Not tainted ------------------------------------- a.out/12486 is trying to release lock (sb_writers) at: mnt_drop_write+0x1f/0x30 but there are no more locks to release! Signed-off-by: Vladimir Davydov <vdavydov@parallels.com> Cc: Doug Ledford <dledford@redhat.com> Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com> Cc: "Eric W. Biederman" <ebiederm@xmission.com> Cc: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'ipc')
-rw-r--r--ipc/mqueue.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/ipc/mqueue.c b/ipc/mqueue.c
index 71a3ca18c873..6ebfbf52712d 100644
--- a/ipc/mqueue.c
+++ b/ipc/mqueue.c
@@ -840,7 +840,8 @@ out_putfd:
840 fd = error; 840 fd = error;
841 } 841 }
842 mutex_unlock(&root->d_inode->i_mutex); 842 mutex_unlock(&root->d_inode->i_mutex);
843 mnt_drop_write(mnt); 843 if (!ro)
844 mnt_drop_write(mnt);
844out_putname: 845out_putname:
845 putname(name); 846 putname(name);
846 return fd; 847 return fd;