Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752071Ab3IRJsW (ORCPT ); Wed, 18 Sep 2013 05:48:22 -0400 Received: from mail-la0-f49.google.com ([209.85.215.49]:61847 "EHLO mail-la0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751537Ab3IRJsU (ORCPT ); Wed, 18 Sep 2013 05:48:20 -0400 Subject: [PATCH] audit: fix endless wait in audit_log_start() To: linux-kernel@vger.kernel.org From: Konstantin Khlebnikov Cc: Richard Guy Briggs , Eric Paris , Luiz Capitulino , Dan Duval , Dave Kleikamp , Chuck Anderson , Andrew Morton Date: Wed, 18 Sep 2013 13:48:17 +0400 Message-ID: <20130918094817.18754.8847.stgit@zurg> In-Reply-To: <20130917152842.51158606ed46ec67b97b4448@linux-foundation.org> References: <20130917152842.51158606ed46ec67b97b4448@linux-foundation.org> User-Agent: StGit/0.15 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1461 Lines: 40 After commit 829199197a430dade2519d54f5545c4a094393b8 audit emiters will block forever if userspace daemon cannot handle backlog. After the timeout waiting loop turns into busy loop and runs until daemon dies or returns back to work. This is minimal patch for that bug. Signed-off-by: Konstantin Khlebnikov Cc: Andrew Morton Cc: Luiz Capitulino Cc: Richard Guy Briggs Cc: Eric Paris Cc: Chuck Anderson Cc: Dan Duval Cc: Dave Kleikamp --- kernel/audit.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/kernel/audit.c b/kernel/audit.c index 91e53d0..7b0e23a 100644 --- a/kernel/audit.c +++ b/kernel/audit.c @@ -1117,9 +1117,10 @@ struct audit_buffer *audit_log_start(struct audit_context *ctx, gfp_t gfp_mask, sleep_time = timeout_start + audit_backlog_wait_time - jiffies; - if ((long)sleep_time > 0) + if ((long)sleep_time > 0) { wait_for_auditd(sleep_time); - continue; + continue; + } } if (audit_rate_check() && printk_ratelimit()) printk(KERN_WARNING -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/