lkml.org 
[lkml]   [2013]   [Apr]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    Subject[ 046/171 ] mqueue: sys_mq_open: do not call mnt_drop_write() if read-only
    3.6.11.2 stable review patch.
    If anyone has any objections, please let me know.

    ------------------

    From: Vladimir Davydov <vdavydov@parallels.com>

    [ Upstream commit 38d78e587d4960d0db94add518d27ee74bad2301 ]

    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>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
    ---
    ipc/mqueue.c | 3 ++-
    1 file changed, 2 insertions(+), 1 deletion(-)

    diff --git a/ipc/mqueue.c b/ipc/mqueue.c
    index 9a08acc..9e4cf7f 100644
    --- a/ipc/mqueue.c
    +++ b/ipc/mqueue.c
    @@ -841,7 +841,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.10.4



    \
     
     \ /
      Last update: 2013-04-12 00:01    [W:4.443 / U:0.328 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site