Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[PATCH] preparation to __user_walk_fd cleanup

Almost all users __user_walk_fd() and friends care only about struct path.
Get rid of the few that do not.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

Al Viro 256984a8 f419a2e3

+11 -9
+1 -1
fs/inotify_user.c
··· 365 if (error) 366 return error; 367 /* you can only watch an inode if you have read permissions on it */ 368 - error = vfs_permission(nd, MAY_READ); 369 if (error) 370 path_put(&nd->path); 371 return error;
··· 365 if (error) 366 return error; 367 /* you can only watch an inode if you have read permissions on it */ 368 + error = inode_permission(nd->path.dentry->d_inode, MAY_READ); 369 if (error) 370 path_put(&nd->path); 371 return error;
+10 -8
fs/open.c
··· 251 if (error) 252 goto dput_and_out; 253 254 - error = vfs_permission(&nd, MAY_WRITE); 255 if (error) 256 goto mnt_drop_write_and_out; 257 ··· 426 asmlinkage long sys_faccessat(int dfd, const char __user *filename, int mode) 427 { 428 struct nameidata nd; 429 int old_fsuid, old_fsgid; 430 kernel_cap_t uninitialized_var(old_cap); /* !SECURE_NO_SETUID_FIXUP */ 431 int res; ··· 462 if (res) 463 goto out; 464 465 - if ((mode & MAY_EXEC) && S_ISREG(nd.path.dentry->d_inode->i_mode)) { 466 /* 467 * MAY_EXEC on regular files is denied if the fs is mounted 468 * with the "noexec" flag. ··· 474 goto out_path_release; 475 } 476 477 - res = vfs_permission(&nd, mode | MAY_ACCESS); 478 /* SuS v2 requires we report a read only fs too */ 479 - if(res || !(mode & S_IWOTH) || 480 - special_file(nd.path.dentry->d_inode->i_mode)) 481 goto out_path_release; 482 /* 483 * This is a rare case where using __mnt_is_readonly() ··· 517 if (error) 518 goto out; 519 520 - error = vfs_permission(&nd, MAY_EXEC | MAY_ACCESS); 521 if (error) 522 goto dput_and_out; 523 ··· 546 if (!S_ISDIR(inode->i_mode)) 547 goto out_putf; 548 549 - error = file_permission(file, MAY_EXEC | MAY_ACCESS); 550 if (!error) 551 set_fs_pwd(current->fs, &file->f_path); 552 out_putf: ··· 564 if (error) 565 goto out; 566 567 - error = vfs_permission(&nd, MAY_EXEC | MAY_ACCESS); 568 if (error) 569 goto dput_and_out; 570
··· 251 if (error) 252 goto dput_and_out; 253 254 + error = inode_permission(inode, MAY_WRITE); 255 if (error) 256 goto mnt_drop_write_and_out; 257 ··· 426 asmlinkage long sys_faccessat(int dfd, const char __user *filename, int mode) 427 { 428 struct nameidata nd; 429 + struct inode *inode; 430 int old_fsuid, old_fsgid; 431 kernel_cap_t uninitialized_var(old_cap); /* !SECURE_NO_SETUID_FIXUP */ 432 int res; ··· 461 if (res) 462 goto out; 463 464 + inode = nd.path.dentry->d_inode; 465 + 466 + if ((mode & MAY_EXEC) && S_ISREG(inode->i_mode)) { 467 /* 468 * MAY_EXEC on regular files is denied if the fs is mounted 469 * with the "noexec" flag. ··· 471 goto out_path_release; 472 } 473 474 + res = inode_permission(inode, mode | MAY_ACCESS); 475 /* SuS v2 requires we report a read only fs too */ 476 + if (res || !(mode & S_IWOTH) || special_file(inode->i_mode)) 477 goto out_path_release; 478 /* 479 * This is a rare case where using __mnt_is_readonly() ··· 515 if (error) 516 goto out; 517 518 + error = inode_permission(nd.path.dentry->d_inode, MAY_EXEC | MAY_ACCESS); 519 if (error) 520 goto dput_and_out; 521 ··· 544 if (!S_ISDIR(inode->i_mode)) 545 goto out_putf; 546 547 + error = inode_permission(inode, MAY_EXEC | MAY_ACCESS); 548 if (!error) 549 set_fs_pwd(current->fs, &file->f_path); 550 out_putf: ··· 562 if (error) 563 goto out; 564 565 + error = inode_permission(nd.path.dentry->d_inode, MAY_EXEC | MAY_ACCESS); 566 if (error) 567 goto dput_and_out; 568