aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds2012-04-02 17:48:12 -0500
committerLinus Torvalds2012-04-03 11:49:59 -0500
commitb61c37f57988567c84359645f8202a7c84bc798a (patch)
treea808c891711d060060a751f4119198dc06e2c847 /security/lsm_audit.c
parent3f0882c48286e7bdb0bbdec9c4bfa934e0db8e09 (diff)
downloadkernel-common-b61c37f57988567c84359645f8202a7c84bc798a.tar.gz
kernel-common-b61c37f57988567c84359645f8202a7c84bc798a.tar.xz
kernel-common-b61c37f57988567c84359645f8202a7c84bc798a.zip
lsm_audit: don't specify the audit pre/post callbacks in 'struct common_audit_data'
It just bloats the audit data structure for no good reason, since the only time those fields are filled are just before calling the common_lsm_audit() function, which is also the only user of those fields. So just make them be the arguments to common_lsm_audit(), rather than bloating that structure that is passed around everywhere, and is initialized in hot paths. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'security/lsm_audit.c')
-rw-r--r--security/lsm_audit.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/security/lsm_audit.c b/security/lsm_audit.c
index e96c6aa17bb..90c129b0102 100644
--- a/security/lsm_audit.c
+++ b/security/lsm_audit.c
@@ -378,11 +378,15 @@ static void dump_common_audit_data(struct audit_buffer *ab,
378/** 378/**
379 * common_lsm_audit - generic LSM auditing function 379 * common_lsm_audit - generic LSM auditing function
380 * @a: auxiliary audit data 380 * @a: auxiliary audit data
381 * @pre_audit: lsm-specific pre-audit callback
382 * @post_audit: lsm-specific post-audit callback
381 * 383 *
382 * setup the audit buffer for common security information 384 * setup the audit buffer for common security information
383 * uses callback to print LSM specific information 385 * uses callback to print LSM specific information
384 */ 386 */
385void common_lsm_audit(struct common_audit_data *a) 387void common_lsm_audit(struct common_audit_data *a,
388 void (*pre_audit)(struct audit_buffer *, void *),
389 void (*post_audit)(struct audit_buffer *, void *))
386{ 390{
387 struct audit_buffer *ab; 391 struct audit_buffer *ab;
388 392
@@ -394,13 +398,13 @@ void common_lsm_audit(struct common_audit_data *a)
394 if (ab == NULL) 398 if (ab == NULL)
395 return; 399 return;
396 400
397 if (a->lsm_pre_audit) 401 if (pre_audit)
398 a->lsm_pre_audit(ab, a); 402 pre_audit(ab, a);
399 403
400 dump_common_audit_data(ab, a); 404 dump_common_audit_data(ab, a);
401 405
402 if (a->lsm_post_audit) 406 if (post_audit)
403 a->lsm_post_audit(ab, a); 407 post_audit(ab, a);
404 408
405 audit_log_end(ab); 409 audit_log_end(ab);
406} 410}