aboutsummaryrefslogtreecommitdiffstats
path: root/fs/open.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2012-08-26 20:13:36 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2012-09-26 21:10:02 -0400
commitbf2965d5b5950d09e934ea5d961d79d0ed1fae7e (patch)
treeabff32286098495fe01355186bde557a70c2e088 /fs/open.c
parentf6d2ac5ca79d1fd468dbc77e488aec06e86f3035 (diff)
switch ftruncate(2) to fget_light
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/open.c')
-rw-r--r--fs/open.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/fs/open.c b/fs/open.c
index 03028d0e7487..9f61d7269d39 100644
--- a/fs/open.c
+++ b/fs/open.c
@@ -132,16 +132,16 @@ SYSCALL_DEFINE2(truncate, const char __user *, path, long, length)
132 132
133static long do_sys_ftruncate(unsigned int fd, loff_t length, int small) 133static long do_sys_ftruncate(unsigned int fd, loff_t length, int small)
134{ 134{
135 struct inode * inode; 135 struct inode *inode;
136 struct dentry *dentry; 136 struct dentry *dentry;
137 struct file * file; 137 struct file *file;
138 int error; 138 int error, fput_needed;
139 139
140 error = -EINVAL; 140 error = -EINVAL;
141 if (length < 0) 141 if (length < 0)
142 goto out; 142 goto out;
143 error = -EBADF; 143 error = -EBADF;
144 file = fget(fd); 144 file = fget_light(fd, &fput_needed);
145 if (!file) 145 if (!file)
146 goto out; 146 goto out;
147 147
@@ -172,7 +172,7 @@ static long do_sys_ftruncate(unsigned int fd, loff_t length, int small)
172 error = do_truncate(dentry, length, ATTR_MTIME|ATTR_CTIME, file); 172 error = do_truncate(dentry, length, ATTR_MTIME|ATTR_CTIME, file);
173 sb_end_write(inode->i_sb); 173 sb_end_write(inode->i_sb);
174out_putf: 174out_putf:
175 fput(file); 175 fput_light(file, fput_needed);
176out: 176out:
177 return error; 177 return error;
178} 178}