diff options
-rw-r--r-- | fs/namei.c | 14 | ||||
-rw-r--r-- | fs/nfsctl.c | 5 | ||||
-rw-r--r-- | include/linux/fs.h | 2 |
3 files changed, 11 insertions, 10 deletions
diff --git a/fs/namei.c b/fs/namei.c index d4d0b59ed2cc..5cc0dc95a7a5 100644 --- a/fs/namei.c +++ b/fs/namei.c | |||
@@ -1487,9 +1487,9 @@ int vfs_create(struct inode *dir, struct dentry *dentry, int mode, | |||
1487 | return error; | 1487 | return error; |
1488 | } | 1488 | } |
1489 | 1489 | ||
1490 | int may_open(struct nameidata *nd, int acc_mode, int flag) | 1490 | int may_open(struct path *path, int acc_mode, int flag) |
1491 | { | 1491 | { |
1492 | struct dentry *dentry = nd->path.dentry; | 1492 | struct dentry *dentry = path->dentry; |
1493 | struct inode *inode = dentry->d_inode; | 1493 | struct inode *inode = dentry->d_inode; |
1494 | int error; | 1494 | int error; |
1495 | 1495 | ||
@@ -1510,13 +1510,13 @@ int may_open(struct nameidata *nd, int acc_mode, int flag) | |||
1510 | if (S_ISFIFO(inode->i_mode) || S_ISSOCK(inode->i_mode)) { | 1510 | if (S_ISFIFO(inode->i_mode) || S_ISSOCK(inode->i_mode)) { |
1511 | flag &= ~O_TRUNC; | 1511 | flag &= ~O_TRUNC; |
1512 | } else if (S_ISBLK(inode->i_mode) || S_ISCHR(inode->i_mode)) { | 1512 | } else if (S_ISBLK(inode->i_mode) || S_ISCHR(inode->i_mode)) { |
1513 | if (nd->path.mnt->mnt_flags & MNT_NODEV) | 1513 | if (path->mnt->mnt_flags & MNT_NODEV) |
1514 | return -EACCES; | 1514 | return -EACCES; |
1515 | 1515 | ||
1516 | flag &= ~O_TRUNC; | 1516 | flag &= ~O_TRUNC; |
1517 | } | 1517 | } |
1518 | 1518 | ||
1519 | error = vfs_permission(nd, acc_mode); | 1519 | error = inode_permission(inode, acc_mode); |
1520 | if (error) | 1520 | if (error) |
1521 | return error; | 1521 | return error; |
1522 | /* | 1522 | /* |
@@ -1551,7 +1551,7 @@ int may_open(struct nameidata *nd, int acc_mode, int flag) | |||
1551 | */ | 1551 | */ |
1552 | error = locks_verify_locked(inode); | 1552 | error = locks_verify_locked(inode); |
1553 | if (!error) | 1553 | if (!error) |
1554 | error = security_path_truncate(&nd->path, 0, | 1554 | error = security_path_truncate(path, 0, |
1555 | ATTR_MTIME|ATTR_CTIME|ATTR_OPEN); | 1555 | ATTR_MTIME|ATTR_CTIME|ATTR_OPEN); |
1556 | if (!error) { | 1556 | if (!error) { |
1557 | DQUOT_INIT(inode); | 1557 | DQUOT_INIT(inode); |
@@ -1594,7 +1594,7 @@ out_unlock: | |||
1594 | if (error) | 1594 | if (error) |
1595 | return error; | 1595 | return error; |
1596 | /* Don't check for write permission, don't truncate */ | 1596 | /* Don't check for write permission, don't truncate */ |
1597 | return may_open(nd, 0, flag & ~O_TRUNC); | 1597 | return may_open(&nd->path, 0, flag & ~O_TRUNC); |
1598 | } | 1598 | } |
1599 | 1599 | ||
1600 | /* | 1600 | /* |
@@ -1780,7 +1780,7 @@ ok: | |||
1780 | if (error) | 1780 | if (error) |
1781 | goto exit; | 1781 | goto exit; |
1782 | } | 1782 | } |
1783 | error = may_open(&nd, acc_mode, flag); | 1783 | error = may_open(&nd.path, acc_mode, flag); |
1784 | if (error) { | 1784 | if (error) { |
1785 | if (will_write) | 1785 | if (will_write) |
1786 | mnt_drop_write(nd.path.mnt); | 1786 | mnt_drop_write(nd.path.mnt); |
diff --git a/fs/nfsctl.c b/fs/nfsctl.c index b1acbd6ab6fb..b27451909dff 100644 --- a/fs/nfsctl.c +++ b/fs/nfsctl.c | |||
@@ -38,9 +38,10 @@ static struct file *do_open(char *name, int flags) | |||
38 | return ERR_PTR(error); | 38 | return ERR_PTR(error); |
39 | 39 | ||
40 | if (flags == O_RDWR) | 40 | if (flags == O_RDWR) |
41 | error = may_open(&nd,MAY_READ|MAY_WRITE,FMODE_READ|FMODE_WRITE); | 41 | error = may_open(&nd.path, MAY_READ|MAY_WRITE, |
42 | FMODE_READ|FMODE_WRITE); | ||
42 | else | 43 | else |
43 | error = may_open(&nd, MAY_WRITE, FMODE_WRITE); | 44 | error = may_open(&nd.path, MAY_WRITE, FMODE_WRITE); |
44 | 45 | ||
45 | if (!error) | 46 | if (!error) |
46 | return dentry_open(nd.path.dentry, nd.path.mnt, flags, | 47 | return dentry_open(nd.path.dentry, nd.path.mnt, flags, |
diff --git a/include/linux/fs.h b/include/linux/fs.h index c5e4c5c74034..3468df5a06e0 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
@@ -1869,7 +1869,7 @@ extern void free_write_pipe(struct file *); | |||
1869 | 1869 | ||
1870 | extern struct file *do_filp_open(int dfd, const char *pathname, | 1870 | extern struct file *do_filp_open(int dfd, const char *pathname, |
1871 | int open_flag, int mode); | 1871 | int open_flag, int mode); |
1872 | extern int may_open(struct nameidata *, int, int); | 1872 | extern int may_open(struct path *, int, int); |
1873 | 1873 | ||
1874 | extern int kernel_read(struct file *, unsigned long, char *, unsigned long); | 1874 | extern int kernel_read(struct file *, unsigned long, char *, unsigned long); |
1875 | extern struct file * open_exec(const char *); | 1875 | extern struct file * open_exec(const char *); |