diff options
Diffstat (limited to 'kernel/audit.c')
-rw-r--r-- | kernel/audit.c | 36 |
1 files changed, 23 insertions, 13 deletions
diff --git a/kernel/audit.c b/kernel/audit.c index a219998aecc1..d596e5355f15 100644 --- a/kernel/audit.c +++ b/kernel/audit.c | |||
@@ -1101,6 +1101,23 @@ static inline void audit_get_stamp(struct audit_context *ctx, | |||
1101 | } | 1101 | } |
1102 | } | 1102 | } |
1103 | 1103 | ||
1104 | /* | ||
1105 | * Wait for auditd to drain the queue a little | ||
1106 | */ | ||
1107 | static void wait_for_auditd(unsigned long sleep_time) | ||
1108 | { | ||
1109 | DECLARE_WAITQUEUE(wait, current); | ||
1110 | set_current_state(TASK_INTERRUPTIBLE); | ||
1111 | add_wait_queue(&audit_backlog_wait, &wait); | ||
1112 | |||
1113 | if (audit_backlog_limit && | ||
1114 | skb_queue_len(&audit_skb_queue) > audit_backlog_limit) | ||
1115 | schedule_timeout(sleep_time); | ||
1116 | |||
1117 | __set_current_state(TASK_RUNNING); | ||
1118 | remove_wait_queue(&audit_backlog_wait, &wait); | ||
1119 | } | ||
1120 | |||
1104 | /* Obtain an audit buffer. This routine does locking to obtain the | 1121 | /* Obtain an audit buffer. This routine does locking to obtain the |
1105 | * audit buffer, but then no locking is required for calls to | 1122 | * audit buffer, but then no locking is required for calls to |
1106 | * audit_log_*format. If the tsk is a task that is currently in a | 1123 | * audit_log_*format. If the tsk is a task that is currently in a |
@@ -1146,20 +1163,13 @@ struct audit_buffer *audit_log_start(struct audit_context *ctx, gfp_t gfp_mask, | |||
1146 | 1163 | ||
1147 | while (audit_backlog_limit | 1164 | while (audit_backlog_limit |
1148 | && skb_queue_len(&audit_skb_queue) > audit_backlog_limit + reserve) { | 1165 | && skb_queue_len(&audit_skb_queue) > audit_backlog_limit + reserve) { |
1149 | if (gfp_mask & __GFP_WAIT && audit_backlog_wait_time | 1166 | if (gfp_mask & __GFP_WAIT && audit_backlog_wait_time) { |
1150 | && time_before(jiffies, timeout_start + audit_backlog_wait_time)) { | 1167 | unsigned long sleep_time; |
1151 | |||
1152 | /* Wait for auditd to drain the queue a little */ | ||
1153 | DECLARE_WAITQUEUE(wait, current); | ||
1154 | set_current_state(TASK_INTERRUPTIBLE); | ||
1155 | add_wait_queue(&audit_backlog_wait, &wait); | ||
1156 | |||
1157 | if (audit_backlog_limit && | ||
1158 | skb_queue_len(&audit_skb_queue) > audit_backlog_limit) | ||
1159 | schedule_timeout(timeout_start + audit_backlog_wait_time - jiffies); | ||
1160 | 1168 | ||
1161 | __set_current_state(TASK_RUNNING); | 1169 | sleep_time = timeout_start + audit_backlog_wait_time - |
1162 | remove_wait_queue(&audit_backlog_wait, &wait); | 1170 | jiffies; |
1171 | if ((long)sleep_time > 0) | ||
1172 | wait_for_auditd(sleep_time); | ||
1163 | continue; | 1173 | continue; |
1164 | } | 1174 | } |
1165 | if (audit_rate_check() && printk_ratelimit()) | 1175 | if (audit_rate_check() && printk_ratelimit()) |