lkml.org 
[lkml]   [2020]   [Mar]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[RFC][PATCH v3 37/55] do_last(): rejoin the common path even earlier in FMODE_{OPENED,CREATED} case
Date
From: Al Viro <viro@zeniv.linux.org.uk>

... getting may_create_in_sticky() checks in FMODE_OPENED case as well.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
---
fs/namei.c | 14 ++++----------
1 file changed, 4 insertions(+), 10 deletions(-)

diff --git a/fs/namei.c b/fs/namei.c
index af2eb52c4a8d..66f236d5aee7 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -3203,14 +3203,7 @@ static const char *do_last(struct nameidata *nd,
if (IS_ERR(dentry))
return ERR_CAST(dentry);

- if (file->f_mode & FMODE_OPENED) {
- audit_inode(nd->name, file->f_path.dentry, 0);
- dput(nd->path.dentry);
- nd->path.dentry = dentry;
- goto finish_open_created;
- }
-
- if (file->f_mode & FMODE_CREATED) {
+ if (file->f_mode & (FMODE_OPENED | FMODE_CREATED)) {
dput(nd->path.dentry);
nd->path.dentry = dentry;
goto finish_open_created;
@@ -3233,7 +3226,9 @@ static const char *do_last(struct nameidata *nd,
error = complete_walk(nd);
if (error)
return ERR_PTR(error);
- audit_inode(nd->name, nd->path.dentry, 0);
+finish_open_created:
+ if (!(file->f_mode & FMODE_CREATED))
+ audit_inode(nd->name, nd->path.dentry, 0);
if (open_flag & O_CREAT) {
if (d_is_dir(nd->path.dentry))
return ERR_PTR(-EISDIR);
@@ -3245,7 +3240,6 @@ static const char *do_last(struct nameidata *nd,
if ((nd->flags & LOOKUP_DIRECTORY) && !d_can_lookup(nd->path.dentry))
return ERR_PTR(-ENOTDIR);

-finish_open_created:
do_truncate = false;
acc_mode = op->acc_mode;
if (file->f_mode & FMODE_CREATED) {
--
2.11.0
\
 
 \ /
  Last update: 2020-03-01 22:53    [W:0.344 / U:43.684 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site