Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ima: ecryptfs fix imbalance message

The unencrypted files are being measured. Update the counters to get
rid of the ecryptfs imbalance message. (http://bugzilla.redhat.com/519737)

Reported-by: Sachin Garg
Cc: Eric Paris <eparis@redhat.com>
Cc: Dustin Kirkland <kirkland@canonical.com>
Cc: James Morris <jmorris@namei.org>
Cc: David Safford <safford@watson.ibm.com>
Cc: stable@kernel.org
Signed-off-by: Mimi Zohar <zohar@us.ibm.com>
Signed-off-by: Tyler Hicks <tyhicks@linux.vnet.ibm.com>

authored by

Mimi Zohar and committed by
Tyler Hicks
36520be8 ed1f2185

+6 -1
+6 -1
fs/ecryptfs/main.c
··· 35 35 #include <linux/key.h> 36 36 #include <linux/parser.h> 37 37 #include <linux/fs_stack.h> 38 + #include <linux/ima.h> 38 39 #include "ecryptfs_kernel.h" 39 40 40 41 /** ··· 119 118 const struct cred *cred = current_cred(); 120 119 struct ecryptfs_inode_info *inode_info = 121 120 ecryptfs_inode_to_private(ecryptfs_dentry->d_inode); 121 + int opened_lower_file = 0; 122 122 int rc = 0; 123 123 124 124 mutex_lock(&inode_info->lower_file_mutex); ··· 136 134 "for lower_dentry [0x%p] and lower_mnt [0x%p]; " 137 135 "rc = [%d]\n", lower_dentry, lower_mnt, rc); 138 136 inode_info->lower_file = NULL; 139 - } 137 + } else 138 + opened_lower_file = 1; 140 139 } 141 140 mutex_unlock(&inode_info->lower_file_mutex); 141 + if (opened_lower_file) 142 + ima_counts_get(inode_info->lower_file); 142 143 return rc; 143 144 } 144 145