diff options
Diffstat (limited to 'fs/open.c')
-rw-r--r-- | fs/open.c | 17 |
1 files changed, 10 insertions, 7 deletions
@@ -199,7 +199,7 @@ out: | |||
199 | int do_truncate(struct dentry *dentry, loff_t length, unsigned int time_attrs, | 199 | int do_truncate(struct dentry *dentry, loff_t length, unsigned int time_attrs, |
200 | struct file *filp) | 200 | struct file *filp) |
201 | { | 201 | { |
202 | int err; | 202 | int ret; |
203 | struct iattr newattrs; | 203 | struct iattr newattrs; |
204 | 204 | ||
205 | /* Not pretty: "inode->i_size" shouldn't really be signed. But it is. */ | 205 | /* Not pretty: "inode->i_size" shouldn't really be signed. But it is. */ |
@@ -214,12 +214,14 @@ int do_truncate(struct dentry *dentry, loff_t length, unsigned int time_attrs, | |||
214 | } | 214 | } |
215 | 215 | ||
216 | /* Remove suid/sgid on truncate too */ | 216 | /* Remove suid/sgid on truncate too */ |
217 | newattrs.ia_valid |= should_remove_suid(dentry); | 217 | ret = should_remove_suid(dentry); |
218 | if (ret) | ||
219 | newattrs.ia_valid |= ret | ATTR_FORCE; | ||
218 | 220 | ||
219 | mutex_lock(&dentry->d_inode->i_mutex); | 221 | mutex_lock(&dentry->d_inode->i_mutex); |
220 | err = notify_change(dentry, &newattrs); | 222 | ret = notify_change(dentry, &newattrs); |
221 | mutex_unlock(&dentry->d_inode->i_mutex); | 223 | mutex_unlock(&dentry->d_inode->i_mutex); |
222 | return err; | 224 | return ret; |
223 | } | 225 | } |
224 | 226 | ||
225 | static long do_sys_truncate(const char __user *pathname, loff_t length) | 227 | static long do_sys_truncate(const char __user *pathname, loff_t length) |
@@ -288,10 +290,9 @@ out: | |||
288 | return error; | 290 | return error; |
289 | } | 291 | } |
290 | 292 | ||
291 | SYSCALL_DEFINE2(truncate, const char __user *, path, unsigned long, length) | 293 | SYSCALL_DEFINE2(truncate, const char __user *, path, long, length) |
292 | { | 294 | { |
293 | /* on 32-bit boxen it will cut the range 2^31--2^32-1 off */ | 295 | return do_sys_truncate(path, length); |
294 | return do_sys_truncate(path, (long)length); | ||
295 | } | 296 | } |
296 | 297 | ||
297 | static long do_sys_ftruncate(unsigned int fd, loff_t length, int small) | 298 | static long do_sys_ftruncate(unsigned int fd, loff_t length, int small) |
@@ -957,6 +958,8 @@ struct file *dentry_open(struct dentry *dentry, struct vfsmount *mnt, int flags, | |||
957 | int error; | 958 | int error; |
958 | struct file *f; | 959 | struct file *f; |
959 | 960 | ||
961 | validate_creds(cred); | ||
962 | |||
960 | /* | 963 | /* |
961 | * We must always pass in a valid mount pointer. Historically | 964 | * We must always pass in a valid mount pointer. Historically |
962 | * callers got away with not passing it, but we must enforce this at | 965 | * callers got away with not passing it, but we must enforce this at |