lkml.org 
[lkml]   [2007]   [Sep]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Subject[PATCH 15/25] unix_find_other() elevate write count for touch_atime()
    From
    Date


    Signed-off-by: Dave Hansen <haveblue@us.ibm.com>
    Acked-by: Christoph Hellwig <hch@infradead.org>
    ---

    lxc-dave/net/unix/af_unix.c | 16 ++++++++++++----
    1 file changed, 12 insertions(+), 4 deletions(-)

    diff -puN net/unix/af_unix.c~unix-find-other-elevate-write-count-for-touch-atime net/unix/af_unix.c
    --- lxc/net/unix/af_unix.c~unix-find-other-elevate-write-count-for-touch-atime 2007-09-20 12:16:17.000000000 -0700
    +++ lxc-dave/net/unix/af_unix.c 2007-09-20 12:16:17.000000000 -0700
    @@ -729,21 +729,27 @@ static struct sock *unix_find_other(stru
    err = path_lookup(sunname->sun_path, LOOKUP_FOLLOW, &nd);
    if (err)
    goto fail;
    +
    + err = mnt_want_write(nd.mnt);
    + if (err)
    + goto put_path_fail;
    +
    err = vfs_permission(&nd, MAY_WRITE);
    if (err)
    - goto put_fail;
    + goto mnt_drop_write_fail;

    err = -ECONNREFUSED;
    if (!S_ISSOCK(nd.dentry->d_inode->i_mode))
    - goto put_fail;
    + goto mnt_drop_write_fail;
    u=unix_find_socket_byinode(nd.dentry->d_inode);
    if (!u)
    - goto put_fail;
    + goto mnt_drop_write_fail;

    if (u->sk_type == type)
    touch_atime(nd.mnt, nd.dentry);

    path_release(&nd);
    + mnt_drop_write(nd.mnt);

    err=-EPROTOTYPE;
    if (u->sk_type != type) {
    @@ -763,7 +769,9 @@ static struct sock *unix_find_other(stru
    }
    return u;

    -put_fail:
    +mnt_drop_write_fail:
    + mnt_drop_write(nd.mnt);
    +put_path_fail:
    path_release(&nd);
    fail:
    *error=err;
    _
    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/
    \
     
     \ /
      Last update: 2007-09-20 22:01    [W:0.023 / U:0.096 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site