aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/namei.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/fs/namei.c b/fs/namei.c
index 2792e0ca01d4..a29bb0f40ed5 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -1604,10 +1604,6 @@ int may_open(struct nameidata *nd, int acc_mode, int flag)
1604 if (S_ISDIR(inode->i_mode) && (flag & FMODE_WRITE)) 1604 if (S_ISDIR(inode->i_mode) && (flag & FMODE_WRITE))
1605 return -EISDIR; 1605 return -EISDIR;
1606 1606
1607 error = vfs_permission(nd, acc_mode);
1608 if (error)
1609 return error;
1610
1611 /* 1607 /*
1612 * FIFO's, sockets and device files are special: they don't 1608 * FIFO's, sockets and device files are special: they don't
1613 * actually live on the filesystem itself, and as such you 1609 * actually live on the filesystem itself, and as such you
@@ -1622,6 +1618,10 @@ int may_open(struct nameidata *nd, int acc_mode, int flag)
1622 flag &= ~O_TRUNC; 1618 flag &= ~O_TRUNC;
1623 } else if (IS_RDONLY(inode) && (flag & FMODE_WRITE)) 1619 } else if (IS_RDONLY(inode) && (flag & FMODE_WRITE))
1624 return -EROFS; 1620 return -EROFS;
1621
1622 error = vfs_permission(nd, acc_mode);
1623 if (error)
1624 return error;
1625 /* 1625 /*
1626 * An append-only file must be opened in append mode for writing. 1626 * An append-only file must be opened in append mode for writing.
1627 */ 1627 */