lkml.org 
[lkml]   [2015]   [Dec]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 4.2 55/61] debugfs: fix refcount imbalance in start_creating
    Date
    4.2-stable review patch.  If anyone has any objections, please let me know.

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

    From: Daniel Borkmann <daniel@iogearbox.net>

    commit 0ee9608c89e81a1ccee52ecb58a7ff040e2522d9 upstream.

    In debugfs' start_creating(), we pin the file system to safely access
    its root. When we failed to create a file, we unpin the file system via
    failed_creating() to release the mount count and eventually the reference
    of the vfsmount.

    However, when we run into an error during lookup_one_len() when still
    in start_creating(), we only release the parent's mutex but not so the
    reference on the mount. Looks like it was done in the past, but after
    splitting portions of __create_file() into start_creating() and
    end_creating() via 190afd81e4a5 ("debugfs: split the beginning and the
    end of __create_file() off"), this seemed missed. Noticed during code
    review.

    Fixes: 190afd81e4a5 ("debugfs: split the beginning and the end of __create_file() off")
    Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
    Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

    ---
    fs/debugfs/inode.c | 6 +++++-
    1 file changed, 5 insertions(+), 1 deletion(-)

    --- a/fs/debugfs/inode.c
    +++ b/fs/debugfs/inode.c
    @@ -271,8 +271,12 @@ static struct dentry *start_creating(con
    dput(dentry);
    dentry = ERR_PTR(-EEXIST);
    }
    - if (IS_ERR(dentry))
    +
    + if (IS_ERR(dentry)) {
    mutex_unlock(&d_inode(parent)->i_mutex);
    + simple_release_fs(&debugfs_mount, &debugfs_mount_count);
    + }
    +
    return dentry;
    }




    \
     
     \ /
      Last update: 2015-12-12 22:01    [W:4.549 / U:0.120 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site