From mboxrd@z Thu Jan 1 00:00:00 1970 From: Greg Edwards Subject: [PATCH] audit: do not panic kernel on invalid audit parameter Date: Tue, 20 Feb 2018 14:33:47 -0700 Message-ID: <20180220213347.21926-1-gedwards@ddn.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-audit-bounces@redhat.com Errors-To: linux-audit-bounces@redhat.com To: linux-audit@redhat.com Cc: Greg Edwards List-Id: linux-audit@redhat.com If you pass in an invalid audit kernel boot parameter, e.g. 'audit=off', the kernel panics very early in boot with no output on the console indicating the problem. This seems overly harsh. Instead, print the error indicating an invalid audit parameter value and leave auditing disabled. Fixes: 80ab4df62706 ("audit: don't use simple_strtol() anymore") Signed-off-by: Greg Edwards --- kernel/audit.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/kernel/audit.c b/kernel/audit.c index 227db99b0f19..d8af7682d6a3 100644 --- a/kernel/audit.c +++ b/kernel/audit.c @@ -1572,8 +1572,10 @@ static int __init audit_enable(char *str) { long val; - if (kstrtol(str, 0, &val)) - panic("audit: invalid 'audit' parameter value (%s)\n", str); + if (kstrtol(str, 0, &val)) { + pr_err("invalid 'audit' parameter value (%s)\n", str); + val = AUDIT_OFF; + } audit_default = (val ? AUDIT_ON : AUDIT_OFF); if (audit_default == AUDIT_OFF) -- 2.14.3