Commit bf2965d5 authored by Al Viro's avatar Al Viro

switch ftruncate(2) to fget_light

Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent f6d2ac5c
...@@ -132,16 +132,16 @@ SYSCALL_DEFINE2(truncate, const char __user *, path, long, length) ...@@ -132,16 +132,16 @@ SYSCALL_DEFINE2(truncate, const char __user *, path, long, length)
static long do_sys_ftruncate(unsigned int fd, loff_t length, int small) static long do_sys_ftruncate(unsigned int fd, loff_t length, int small)
{ {
struct inode * inode; struct inode *inode;
struct dentry *dentry; struct dentry *dentry;
struct file * file; struct file *file;
int error; int error, fput_needed;
error = -EINVAL; error = -EINVAL;
if (length < 0) if (length < 0)
goto out; goto out;
error = -EBADF; error = -EBADF;
file = fget(fd); file = fget_light(fd, &fput_needed);
if (!file) if (!file)
goto out; goto out;
...@@ -172,7 +172,7 @@ static long do_sys_ftruncate(unsigned int fd, loff_t length, int small) ...@@ -172,7 +172,7 @@ static long do_sys_ftruncate(unsigned int fd, loff_t length, int small)
error = do_truncate(dentry, length, ATTR_MTIME|ATTR_CTIME, file); error = do_truncate(dentry, length, ATTR_MTIME|ATTR_CTIME, file);
sb_end_write(inode->i_sb); sb_end_write(inode->i_sb);
out_putf: out_putf:
fput(file); fput_light(file, fput_needed);
out: out:
return error; return error;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment