X-Git-Url: http://pileus.org/git/?a=blobdiff_plain;f=security%2Flsm_audit.c;h=8d8d97dbb389b1d305352cee29e4dbcc0191af64;hb=06272911485850b4a336122958c50af0f8ea7c13;hp=90c129b0102f5cbe43129695bde3c3b924b84987;hpb=1e20932a23578bb1ec59107843574e259b96193f;p=~andy%2Flinux diff --git a/security/lsm_audit.c b/security/lsm_audit.c index 90c129b0102..8d8d97dbb38 100644 --- a/security/lsm_audit.c +++ b/security/lsm_audit.c @@ -213,12 +213,15 @@ static void dump_common_audit_data(struct audit_buffer *ab, { struct task_struct *tsk = current; - if (a->tsk) - tsk = a->tsk; - if (tsk && tsk->pid) { - audit_log_format(ab, " pid=%d comm=", tsk->pid); - audit_log_untrustedstring(ab, tsk->comm); - } + /* + * To keep stack sizes in check force programers to notice if they + * start making this union too large! See struct lsm_network_audit + * as an example of how to deal with large data. + */ + BUILD_BUG_ON(sizeof(a->u) > sizeof(void *)*2); + + audit_log_format(ab, " pid=%d comm=", tsk->pid); + audit_log_untrustedstring(ab, tsk->comm); switch (a->type) { case LSM_AUDIT_DATA_NONE: