aboutsummaryrefslogtreecommitdiffstats
path: root/security/lsm_audit.c
diff options
context:
space:
mode:
authorEric Paris <eparis@redhat.com>2011-04-25 13:10:27 -0400
committerEric Paris <eparis@redhat.com>2011-04-25 18:14:07 -0400
commita269434d2fb48a4d66c1d7bf821b7874b59c5b41 (patch)
tree9c84b5f3e9f3adb3dd4a7e9da2b72dd7fe7eec49 /security/lsm_audit.c
parentf48b7399840b453e7282b523f535561fe9638a2d (diff)
LSM: separate LSM_AUDIT_DATA_DENTRY from LSM_AUDIT_DATA_PATH
This patch separates and audit message that only contains a dentry from one that contains a full path. This allows us to make it harder to misuse the interfaces or for the interfaces to be implemented wrong. Signed-off-by: Eric Paris <eparis@redhat.com> Acked-by: Casey Schaufler <casey@schaufler-ca.com>
Diffstat (limited to 'security/lsm_audit.c')
-rw-r--r--security/lsm_audit.c25
1 files changed, 16 insertions, 9 deletions
diff --git a/security/lsm_audit.c b/security/lsm_audit.c
index 2e846052cbf4..893af8a2fa1e 100644
--- a/security/lsm_audit.c
+++ b/security/lsm_audit.c
@@ -229,17 +229,24 @@ static void dump_common_audit_data(struct audit_buffer *ab,
229 audit_log_format(ab, " capability=%d ", a->u.cap); 229 audit_log_format(ab, " capability=%d ", a->u.cap);
230 break; 230 break;
231 case LSM_AUDIT_DATA_PATH: { 231 case LSM_AUDIT_DATA_PATH: {
232 struct dentry *dentry = a->u.path.dentry;
233 struct inode *inode; 232 struct inode *inode;
234 233
235 if (a->u.path.mnt) { 234 audit_log_d_path(ab, "path=", &a->u.path);
236 audit_log_d_path(ab, "path=", &a->u.path); 235
237 } else { 236 inode = a->u.path.dentry->d_inode;
238 audit_log_format(ab, " name="); 237 if (inode)
239 audit_log_untrustedstring(ab, 238 audit_log_format(ab, " dev=%s ino=%lu",
240 dentry->d_name.name); 239 inode->i_sb->s_id,
241 } 240 inode->i_ino);
242 inode = dentry->d_inode; 241 break;
242 }
243 case LSM_AUDIT_DATA_DENTRY: {
244 struct inode *inode;
245
246 audit_log_format(ab, " name=");
247 audit_log_untrustedstring(ab, a->u.dentry->d_name.name);
248
249 inode = a->u.dentry->d_inode;
243 if (inode) 250 if (inode)
244 audit_log_format(ab, " dev=%s ino=%lu", 251 audit_log_format(ab, " dev=%s ino=%lu",
245 inode->i_sb->s_id, 252 inode->i_sb->s_id,