lkml.org 
[lkml]   [2009]   [Jan]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 5/5] switch compat readv/preadv/writev/pwritev from fget to fget_light
    Date

    Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
    ---
    fs/compat.c | 20 ++++++++++++--------
    1 files changed, 12 insertions(+), 8 deletions(-)

    diff --git a/fs/compat.c b/fs/compat.c
    index 20fec0e..90a10e9 100644
    --- a/fs/compat.c
    +++ b/fs/compat.c
    @@ -1192,13 +1192,14 @@ asmlinkage ssize_t
    compat_sys_readv(unsigned long fd, const struct compat_iovec __user *vec, unsigned long vlen)
    {
    struct file *file;
    + int fput_needed;
    ssize_t ret;

    - file = fget(fd);
    + file = fget_light(fd, &fput_needed);
    if (!file)
    return -EBADF;
    ret = compat_readv(file, vec, vlen, &file->f_pos);
    - fput(file);
    + fput_light(file, fput_needed);
    return ret;
    }

    @@ -1208,15 +1209,16 @@ compat_sys_preadv(unsigned long fd, const struct compat_iovec __user *vec,
    {
    loff_t pos = ((loff_t)pos_high << 32) | pos_low;
    struct file *file;
    + int fput_needed;
    ssize_t ret;

    if (pos < 0)
    return -EINVAL;
    - file = fget(fd);
    + file = fget_light(fd, &fput_needed);
    if (!file)
    return -EBADF;
    ret = compat_readv(file, vec, vlen, &pos);
    - fput(file);
    + fput_light(file, fput_needed);
    return ret;
    }

    @@ -1245,13 +1247,14 @@ asmlinkage ssize_t
    compat_sys_writev(unsigned long fd, const struct compat_iovec __user *vec, unsigned long vlen)
    {
    struct file *file;
    + int fput_needed;
    ssize_t ret;

    - file = fget(fd);
    + file = fget_light(fd, &fput_needed);
    if (!file)
    return -EBADF;
    ret = compat_writev(file, vec, vlen, &file->f_pos);
    - fput(file);
    + fput_light(file, fput_needed);
    return ret;
    }

    @@ -1261,15 +1264,16 @@ compat_sys_pwritev(unsigned long fd, const struct compat_iovec __user *vec,
    {
    loff_t pos = ((loff_t)pos_high << 32) | pos_low;
    struct file *file;
    + int fput_needed;
    ssize_t ret;

    if (pos < 0)
    return -EINVAL;
    - file = fget(fd);
    + file = fget_light(fd, &fput_needed);
    if (!file)
    return -EBADF;
    ret = compat_writev(file, vec, vlen, &pos);
    - fput(file);
    + fput_light(file, fput_needed);
    return ret;
    }

    --
    1.6.1


    \
     
     \ /
      Last update: 2009-01-16 17:51    [W:0.025 / U:126.928 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site