Skip to content

Commit

Permalink
ima: pass the file descriptor to ima_add_violation()
Browse files Browse the repository at this point in the history
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: Roberto Sassu <roberto.sassu@polito.it>
Signed-off-by: Mimi Zohar <zohar@linux.vnet.ibm.com>
  • Loading branch information
Roberto Sassu authored and Mimi Zohar committed Oct 25, 2013
1 parent 09ef543 commit 7d802a2
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion security/integrity/ima/ima.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
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);
int ima_init_crypto(void);

Expand Down
3 changes: 2 additions & 1 deletion security/integrity/ima/ima_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
* 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)
{
struct ima_template_entry *entry;
struct inode *inode = file->f_dentry->d_inode;
int violation = 1;
int result;

Expand Down
5 changes: 2 additions & 3 deletions security/integrity/ima/ima_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,9 @@ static void ima_rdwr_violation_check(struct file *file)
pathname = dentry->d_name.name;

if (send_tomtou)
ima_add_violation(inode, pathname,
"invalid_pcr", "ToMToU");
ima_add_violation(file, pathname, "invalid_pcr", "ToMToU");
if (send_writers)
ima_add_violation(inode, pathname,
ima_add_violation(file, pathname,
"invalid_pcr", "open_writers");
kfree(pathbuf);
}
Expand Down

0 comments on commit 7d802a2

Please sign in to comment.