Commit 7d802a22 authored by Roberto Sassu's avatar Roberto Sassu Committed by Mimi Zohar

ima: pass the file descriptor to ima_add_violation()

Pass the file descriptor instead of the inode to ima_add_violation(),
to make the latter consistent with ima_store_measurement() in
preparation for the new template architecture.
Signed-off-by: default avatarRoberto Sassu <roberto.sassu@polito.it>
Signed-off-by: default avatarMimi Zohar <zohar@linux.vnet.ibm.com>
parent 09ef5435
...@@ -74,7 +74,7 @@ int ima_calc_file_hash(struct file *file, struct ima_digest_data *hash); ...@@ -74,7 +74,7 @@ int ima_calc_file_hash(struct file *file, struct ima_digest_data *hash);
int ima_calc_buffer_hash(const void *data, int len, int ima_calc_buffer_hash(const void *data, int len,
struct ima_digest_data *hash); struct ima_digest_data *hash);
int __init ima_calc_boot_aggregate(struct ima_digest_data *hash); int __init ima_calc_boot_aggregate(struct ima_digest_data *hash);
void ima_add_violation(struct inode *inode, const unsigned char *filename, void ima_add_violation(struct file *file, const unsigned char *filename,
const char *op, const char *cause); const char *op, const char *cause);
int ima_init_crypto(void); int ima_init_crypto(void);
......
...@@ -78,10 +78,11 @@ int ima_store_template(struct ima_template_entry *entry, ...@@ -78,10 +78,11 @@ int ima_store_template(struct ima_template_entry *entry,
* By extending the PCR with 0xFF's instead of with zeroes, the PCR * By extending the PCR with 0xFF's instead of with zeroes, the PCR
* value is invalidated. * value is invalidated.
*/ */
void ima_add_violation(struct inode *inode, const unsigned char *filename, void ima_add_violation(struct file *file, const unsigned char *filename,
const char *op, const char *cause) const char *op, const char *cause)
{ {
struct ima_template_entry *entry; struct ima_template_entry *entry;
struct inode *inode = file->f_dentry->d_inode;
int violation = 1; int violation = 1;
int result; int result;
......
...@@ -94,10 +94,9 @@ static void ima_rdwr_violation_check(struct file *file) ...@@ -94,10 +94,9 @@ static void ima_rdwr_violation_check(struct file *file)
pathname = dentry->d_name.name; pathname = dentry->d_name.name;
if (send_tomtou) if (send_tomtou)
ima_add_violation(inode, pathname, ima_add_violation(file, pathname, "invalid_pcr", "ToMToU");
"invalid_pcr", "ToMToU");
if (send_writers) if (send_writers)
ima_add_violation(inode, pathname, ima_add_violation(file, pathname,
"invalid_pcr", "open_writers"); "invalid_pcr", "open_writers");
kfree(pathbuf); kfree(pathbuf);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment