mirror of
https://github.com/tbsdtv/linux_media.git
synced 2025-07-23 12:43:29 +02:00
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>
This commit is contained in:
@@ -378,11 +378,15 @@ static void dump_common_audit_data(struct audit_buffer *ab,
|
||||
/**
|
||||
* common_lsm_audit - generic LSM auditing function
|
||||
* @a: auxiliary audit data
|
||||
* @pre_audit: lsm-specific pre-audit callback
|
||||
* @post_audit: lsm-specific post-audit callback
|
||||
*
|
||||
* setup the audit buffer for common security information
|
||||
* uses callback to print LSM specific information
|
||||
*/
|
||||
void common_lsm_audit(struct common_audit_data *a)
|
||||
void common_lsm_audit(struct common_audit_data *a,
|
||||
void (*pre_audit)(struct audit_buffer *, void *),
|
||||
void (*post_audit)(struct audit_buffer *, void *))
|
||||
{
|
||||
struct audit_buffer *ab;
|
||||
|
||||
@@ -394,13 +398,13 @@ void common_lsm_audit(struct common_audit_data *a)
|
||||
if (ab == NULL)
|
||||
return;
|
||||
|
||||
if (a->lsm_pre_audit)
|
||||
a->lsm_pre_audit(ab, a);
|
||||
if (pre_audit)
|
||||
pre_audit(ab, a);
|
||||
|
||||
dump_common_audit_data(ab, a);
|
||||
|
||||
if (a->lsm_post_audit)
|
||||
a->lsm_post_audit(ab, a);
|
||||
if (post_audit)
|
||||
post_audit(ab, a);
|
||||
|
||||
audit_log_end(ab);
|
||||
}
|
||||
|
Reference in New Issue
Block a user