diff options
author | Dmitry Kasatkin <d.kasatkin@samsung.com> | 2014-06-27 19:15:44 +0400 |
---|---|---|
committer | Ben Hutchings <ben@decadent.org.uk> | 2017-08-26 04:14:23 +0300 |
commit | ad4b000f037c80628e1ecfcc8b782eb2bdec49ca (patch) | |
tree | 61701b21299648fa70579a70cbe17f5f77e7bc77 /fs | |
parent | f5f27dab6f310d534afa6239ef4c188393d63a40 (diff) | |
download | linux-ad4b000f037c80628e1ecfcc8b782eb2bdec49ca.tar.xz |
ima: pass 'opened' flag to identify newly created files
commit 3034a146820c26fe6da66a45f6340fe87fe0983a upstream.
Empty files and missing xattrs do not guarantee that a file was
just created. This patch passes FILE_CREATED flag to IMA to
reliably identify new files.
Signed-off-by: Dmitry Kasatkin <d.kasatkin@samsung.com>
Signed-off-by: Mimi Zohar <zohar@linux.vnet.ibm.com>
[bwh: Backported to 3.16: drop change to ima_fw_from_file()]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/namei.c | 2 | ||||
-rw-r--r-- | fs/nfsd/vfs.c | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/fs/namei.c b/fs/namei.c index 55c97a75e5a7..08b95baead3c 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -3086,7 +3086,7 @@ opened: error = open_check_o_direct(file); if (error) goto exit_fput; - error = ima_file_check(file, op->acc_mode); + error = ima_file_check(file, op->acc_mode, *opened); if (error) goto exit_fput; diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c index 5c7f72cea0de..2f5de024f204 100644 --- a/fs/nfsd/vfs.c +++ b/fs/nfsd/vfs.c @@ -736,7 +736,7 @@ nfsd_open(struct svc_rqst *rqstp, struct svc_fh *fhp, umode_t type, host_err = PTR_ERR(*filp); *filp = NULL; } else { - host_err = ima_file_check(*filp, may_flags); + host_err = ima_file_check(*filp, may_flags, 0); if (may_flags & NFSD_MAY_64BIT_COOKIE) (*filp)->f_mode |= FMODE_64BITHASH; |