diff options
Diffstat (limited to 'security/integrity/ima/ima_main.c')
-rw-r--r-- | security/integrity/ima/ima_main.c | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/security/integrity/ima/ima_main.c b/security/integrity/ima/ima_main.c index 149ee1119f87..52ac6cf41f88 100644 --- a/security/integrity/ima/ima_main.c +++ b/security/integrity/ima/ima_main.c | |||
@@ -71,15 +71,14 @@ __setup("ima_hash=", hash_setup); | |||
71 | * ima_rdwr_violation_check | 71 | * ima_rdwr_violation_check |
72 | * | 72 | * |
73 | * Only invalidate the PCR for measured files: | 73 | * Only invalidate the PCR for measured files: |
74 | * - Opening a file for write when already open for read, | 74 | * - Opening a file for write when already open for read, |
75 | * results in a time of measure, time of use (ToMToU) error. | 75 | * results in a time of measure, time of use (ToMToU) error. |
76 | * - Opening a file for read when already open for write, | 76 | * - Opening a file for read when already open for write, |
77 | * could result in a file measurement error. | 77 | * could result in a file measurement error. |
78 | * | 78 | * |
79 | */ | 79 | */ |
80 | static void ima_rdwr_violation_check(struct file *file) | 80 | static void ima_rdwr_violation_check(struct file *file) |
81 | { | 81 | { |
82 | struct dentry *dentry = file->f_path.dentry; | ||
83 | struct inode *inode = file_inode(file); | 82 | struct inode *inode = file_inode(file); |
84 | fmode_t mode = file->f_mode; | 83 | fmode_t mode = file->f_mode; |
85 | int must_measure; | 84 | int must_measure; |
@@ -111,8 +110,6 @@ out: | |||
111 | return; | 110 | return; |
112 | 111 | ||
113 | pathname = ima_d_path(&file->f_path, &pathbuf); | 112 | pathname = ima_d_path(&file->f_path, &pathbuf); |
114 | if (!pathname || strlen(pathname) > IMA_EVENT_NAME_LEN_MAX) | ||
115 | pathname = dentry->d_name.name; | ||
116 | 113 | ||
117 | if (send_tomtou) | 114 | if (send_tomtou) |
118 | ima_add_violation(file, pathname, "invalid_pcr", "ToMToU"); | 115 | ima_add_violation(file, pathname, "invalid_pcr", "ToMToU"); |
@@ -220,9 +217,7 @@ static int process_measurement(struct file *file, const char *filename, | |||
220 | if (rc != 0) | 217 | if (rc != 0) |
221 | goto out_digsig; | 218 | goto out_digsig; |
222 | 219 | ||
223 | pathname = !filename ? ima_d_path(&file->f_path, &pathbuf) : filename; | 220 | pathname = filename ?: ima_d_path(&file->f_path, &pathbuf); |
224 | if (!pathname) | ||
225 | pathname = (const char *)file->f_dentry->d_name.name; | ||
226 | 221 | ||
227 | if (action & IMA_MEASURE) | 222 | if (action & IMA_MEASURE) |
228 | ima_store_measurement(iint, file, pathname, | 223 | ima_store_measurement(iint, file, pathname, |