diff options
author | James Morris <jmorris@namei.org> | 2009-02-05 19:01:45 -0500 |
---|---|---|
committer | James Morris <jmorris@namei.org> | 2009-02-05 19:01:45 -0500 |
commit | cb5629b10d64a8006622ce3a52bc887d91057d69 (patch) | |
tree | 7c06d8f30783115e3384721046258ce615b129c5 /fs/stat.c | |
parent | 8920d5ad6ba74ae8ab020e90cc4d976980e68701 (diff) | |
parent | f01d1d546abb2f4028b5299092f529eefb01253a (diff) |
Merge branch 'master' into next
Conflicts:
fs/namei.c
Manually merged per:
diff --cc fs/namei.c
index 734f2b5,bbc15c2..0000000
--- a/fs/namei.c
+++ b/fs/namei.c
@@@ -860,9 -848,8 +849,10 @@@ static int __link_path_walk(const char
nd->flags |= LOOKUP_CONTINUE;
err = exec_permission_lite(inode);
if (err == -EAGAIN)
- err = vfs_permission(nd, MAY_EXEC);
+ err = inode_permission(nd->path.dentry->d_inode,
+ MAY_EXEC);
+ if (!err)
+ err = ima_path_check(&nd->path, MAY_EXEC);
if (err)
break;
@@@ -1525,14 -1506,9 +1509,14 @@@ int may_open(struct path *path, int acc
flag &= ~O_TRUNC;
}
- error = vfs_permission(nd, acc_mode);
+ error = inode_permission(inode, acc_mode);
if (error)
return error;
+
- error = ima_path_check(&nd->path,
++ error = ima_path_check(path,
+ acc_mode & (MAY_READ | MAY_WRITE | MAY_EXEC));
+ if (error)
+ return error;
/*
* An append-only file must be opened in append mode for writing.
*/
Signed-off-by: James Morris <jmorris@namei.org>
Diffstat (limited to 'fs/stat.c')
-rw-r--r-- | fs/stat.c | 40 |
1 files changed, 22 insertions, 18 deletions
@@ -152,7 +152,7 @@ static int cp_old_stat(struct kstat *stat, struct __old_kernel_stat __user * sta | |||
152 | return copy_to_user(statbuf,&tmp,sizeof(tmp)) ? -EFAULT : 0; | 152 | return copy_to_user(statbuf,&tmp,sizeof(tmp)) ? -EFAULT : 0; |
153 | } | 153 | } |
154 | 154 | ||
155 | asmlinkage long sys_stat(char __user * filename, struct __old_kernel_stat __user * statbuf) | 155 | SYSCALL_DEFINE2(stat, char __user *, filename, struct __old_kernel_stat __user *, statbuf) |
156 | { | 156 | { |
157 | struct kstat stat; | 157 | struct kstat stat; |
158 | int error = vfs_stat_fd(AT_FDCWD, filename, &stat); | 158 | int error = vfs_stat_fd(AT_FDCWD, filename, &stat); |
@@ -162,7 +162,8 @@ asmlinkage long sys_stat(char __user * filename, struct __old_kernel_stat __user | |||
162 | 162 | ||
163 | return error; | 163 | return error; |
164 | } | 164 | } |
165 | asmlinkage long sys_lstat(char __user * filename, struct __old_kernel_stat __user * statbuf) | 165 | |
166 | SYSCALL_DEFINE2(lstat, char __user *, filename, struct __old_kernel_stat __user *, statbuf) | ||
166 | { | 167 | { |
167 | struct kstat stat; | 168 | struct kstat stat; |
168 | int error = vfs_lstat_fd(AT_FDCWD, filename, &stat); | 169 | int error = vfs_lstat_fd(AT_FDCWD, filename, &stat); |
@@ -172,7 +173,8 @@ asmlinkage long sys_lstat(char __user * filename, struct __old_kernel_stat __use | |||
172 | 173 | ||
173 | return error; | 174 | return error; |
174 | } | 175 | } |
175 | asmlinkage long sys_fstat(unsigned int fd, struct __old_kernel_stat __user * statbuf) | 176 | |
177 | SYSCALL_DEFINE2(fstat, unsigned int, fd, struct __old_kernel_stat __user *, statbuf) | ||
176 | { | 178 | { |
177 | struct kstat stat; | 179 | struct kstat stat; |
178 | int error = vfs_fstat(fd, &stat); | 180 | int error = vfs_fstat(fd, &stat); |
@@ -235,7 +237,7 @@ static int cp_new_stat(struct kstat *stat, struct stat __user *statbuf) | |||
235 | return copy_to_user(statbuf,&tmp,sizeof(tmp)) ? -EFAULT : 0; | 237 | return copy_to_user(statbuf,&tmp,sizeof(tmp)) ? -EFAULT : 0; |
236 | } | 238 | } |
237 | 239 | ||
238 | asmlinkage long sys_newstat(char __user *filename, struct stat __user *statbuf) | 240 | SYSCALL_DEFINE2(newstat, char __user *, filename, struct stat __user *, statbuf) |
239 | { | 241 | { |
240 | struct kstat stat; | 242 | struct kstat stat; |
241 | int error = vfs_stat_fd(AT_FDCWD, filename, &stat); | 243 | int error = vfs_stat_fd(AT_FDCWD, filename, &stat); |
@@ -246,7 +248,7 @@ asmlinkage long sys_newstat(char __user *filename, struct stat __user *statbuf) | |||
246 | return error; | 248 | return error; |
247 | } | 249 | } |
248 | 250 | ||
249 | asmlinkage long sys_newlstat(char __user *filename, struct stat __user *statbuf) | 251 | SYSCALL_DEFINE2(newlstat, char __user *, filename, struct stat __user *, statbuf) |
250 | { | 252 | { |
251 | struct kstat stat; | 253 | struct kstat stat; |
252 | int error = vfs_lstat_fd(AT_FDCWD, filename, &stat); | 254 | int error = vfs_lstat_fd(AT_FDCWD, filename, &stat); |
@@ -258,8 +260,8 @@ asmlinkage long sys_newlstat(char __user *filename, struct stat __user *statbuf) | |||
258 | } | 260 | } |
259 | 261 | ||
260 | #if !defined(__ARCH_WANT_STAT64) || defined(__ARCH_WANT_SYS_NEWFSTATAT) | 262 | #if !defined(__ARCH_WANT_STAT64) || defined(__ARCH_WANT_SYS_NEWFSTATAT) |
261 | asmlinkage long sys_newfstatat(int dfd, char __user *filename, | 263 | SYSCALL_DEFINE4(newfstatat, int, dfd, char __user *, filename, |
262 | struct stat __user *statbuf, int flag) | 264 | struct stat __user *, statbuf, int, flag) |
263 | { | 265 | { |
264 | struct kstat stat; | 266 | struct kstat stat; |
265 | int error = -EINVAL; | 267 | int error = -EINVAL; |
@@ -280,7 +282,7 @@ out: | |||
280 | } | 282 | } |
281 | #endif | 283 | #endif |
282 | 284 | ||
283 | asmlinkage long sys_newfstat(unsigned int fd, struct stat __user *statbuf) | 285 | SYSCALL_DEFINE2(newfstat, unsigned int, fd, struct stat __user *, statbuf) |
284 | { | 286 | { |
285 | struct kstat stat; | 287 | struct kstat stat; |
286 | int error = vfs_fstat(fd, &stat); | 288 | int error = vfs_fstat(fd, &stat); |
@@ -291,8 +293,8 @@ asmlinkage long sys_newfstat(unsigned int fd, struct stat __user *statbuf) | |||
291 | return error; | 293 | return error; |
292 | } | 294 | } |
293 | 295 | ||
294 | asmlinkage long sys_readlinkat(int dfd, const char __user *pathname, | 296 | SYSCALL_DEFINE4(readlinkat, int, dfd, const char __user *, pathname, |
295 | char __user *buf, int bufsiz) | 297 | char __user *, buf, int, bufsiz) |
296 | { | 298 | { |
297 | struct path path; | 299 | struct path path; |
298 | int error; | 300 | int error; |
@@ -305,7 +307,7 @@ asmlinkage long sys_readlinkat(int dfd, const char __user *pathname, | |||
305 | struct inode *inode = path.dentry->d_inode; | 307 | struct inode *inode = path.dentry->d_inode; |
306 | 308 | ||
307 | error = -EINVAL; | 309 | error = -EINVAL; |
308 | if (inode->i_op && inode->i_op->readlink) { | 310 | if (inode->i_op->readlink) { |
309 | error = security_inode_readlink(path.dentry); | 311 | error = security_inode_readlink(path.dentry); |
310 | if (!error) { | 312 | if (!error) { |
311 | touch_atime(path.mnt, path.dentry); | 313 | touch_atime(path.mnt, path.dentry); |
@@ -318,8 +320,8 @@ asmlinkage long sys_readlinkat(int dfd, const char __user *pathname, | |||
318 | return error; | 320 | return error; |
319 | } | 321 | } |
320 | 322 | ||
321 | asmlinkage long sys_readlink(const char __user *path, char __user *buf, | 323 | SYSCALL_DEFINE3(readlink, const char __user *, path, char __user *, buf, |
322 | int bufsiz) | 324 | int, bufsiz) |
323 | { | 325 | { |
324 | return sys_readlinkat(AT_FDCWD, path, buf, bufsiz); | 326 | return sys_readlinkat(AT_FDCWD, path, buf, bufsiz); |
325 | } | 327 | } |
@@ -365,7 +367,7 @@ static long cp_new_stat64(struct kstat *stat, struct stat64 __user *statbuf) | |||
365 | return copy_to_user(statbuf,&tmp,sizeof(tmp)) ? -EFAULT : 0; | 367 | return copy_to_user(statbuf,&tmp,sizeof(tmp)) ? -EFAULT : 0; |
366 | } | 368 | } |
367 | 369 | ||
368 | asmlinkage long sys_stat64(char __user * filename, struct stat64 __user * statbuf) | 370 | SYSCALL_DEFINE2(stat64, char __user *, filename, struct stat64 __user *, statbuf) |
369 | { | 371 | { |
370 | struct kstat stat; | 372 | struct kstat stat; |
371 | int error = vfs_stat(filename, &stat); | 373 | int error = vfs_stat(filename, &stat); |
@@ -375,7 +377,8 @@ asmlinkage long sys_stat64(char __user * filename, struct stat64 __user * statbu | |||
375 | 377 | ||
376 | return error; | 378 | return error; |
377 | } | 379 | } |
378 | asmlinkage long sys_lstat64(char __user * filename, struct stat64 __user * statbuf) | 380 | |
381 | SYSCALL_DEFINE2(lstat64, char __user *, filename, struct stat64 __user *, statbuf) | ||
379 | { | 382 | { |
380 | struct kstat stat; | 383 | struct kstat stat; |
381 | int error = vfs_lstat(filename, &stat); | 384 | int error = vfs_lstat(filename, &stat); |
@@ -385,7 +388,8 @@ asmlinkage long sys_lstat64(char __user * filename, struct stat64 __user * statb | |||
385 | 388 | ||
386 | return error; | 389 | return error; |
387 | } | 390 | } |
388 | asmlinkage long sys_fstat64(unsigned long fd, struct stat64 __user * statbuf) | 391 | |
392 | SYSCALL_DEFINE2(fstat64, unsigned long, fd, struct stat64 __user *, statbuf) | ||
389 | { | 393 | { |
390 | struct kstat stat; | 394 | struct kstat stat; |
391 | int error = vfs_fstat(fd, &stat); | 395 | int error = vfs_fstat(fd, &stat); |
@@ -396,8 +400,8 @@ asmlinkage long sys_fstat64(unsigned long fd, struct stat64 __user * statbuf) | |||
396 | return error; | 400 | return error; |
397 | } | 401 | } |
398 | 402 | ||
399 | asmlinkage long sys_fstatat64(int dfd, char __user *filename, | 403 | SYSCALL_DEFINE4(fstatat64, int, dfd, char __user *, filename, |
400 | struct stat64 __user *statbuf, int flag) | 404 | struct stat64 __user *, statbuf, int, flag) |
401 | { | 405 | { |
402 | struct kstat stat; | 406 | struct kstat stat; |
403 | int error = -EINVAL; | 407 | int error = -EINVAL; |