From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932702AbdDEJBq (ORCPT ); Wed, 5 Apr 2017 05:01:46 -0400 Received: from terminus.zytor.com ([65.50.211.136]:42575 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754073AbdDEJAp (ORCPT ); Wed, 5 Apr 2017 05:00:45 -0400 Date: Wed, 5 Apr 2017 01:56:13 -0700 From: tip-bot for Ard Biesheuvel Message-ID: Cc: hpa@zytor.com, matt@codeblueprint.co.uk, tglx@linutronix.de, mingo@kernel.org, linux-kernel@vger.kernel.org, ard.biesheuvel@linaro.org, torvalds@linux-foundation.org, peterz@infradead.org Reply-To: mingo@kernel.org, tglx@linutronix.de, hpa@zytor.com, matt@codeblueprint.co.uk, peterz@infradead.org, torvalds@linux-foundation.org, ard.biesheuvel@linaro.org, linux-kernel@vger.kernel.org In-Reply-To: <20170404160245.27812-12-ard.biesheuvel@linaro.org> References: <20170404160245.27812-12-ard.biesheuvel@linaro.org> To: linux-tip-commits@vger.kernel.org Subject: [tip:efi/core] efi/libstub: Fix harmless command line parsing bug Git-Commit-ID: 935061e3a7de5eae398327de9f7b92588bfcf7fc X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 935061e3a7de5eae398327de9f7b92588bfcf7fc Gitweb: http://git.kernel.org/tip/935061e3a7de5eae398327de9f7b92588bfcf7fc Author: Ard Biesheuvel AuthorDate: Tue, 4 Apr 2017 17:02:45 +0100 Committer: Ingo Molnar CommitDate: Wed, 5 Apr 2017 09:27:53 +0200 efi/libstub: Fix harmless command line parsing bug When we parse the 'efi=' command line parameter in the stub, we fail to take spaces into account. Currently, the only way this could result in unexpected behavior is when the string 'nochunk' appears as a separate command line argument after 'efi=xxx,yyy,zzz ', so this is harmless in practice. But let's fix it nonetheless. Signed-off-by: Ard Biesheuvel Cc: Linus Torvalds Cc: Matt Fleming Cc: Peter Zijlstra Cc: Thomas Gleixner Cc: linux-efi@vger.kernel.org Link: http://lkml.kernel.org/r/20170404160245.27812-12-ard.biesheuvel@linaro.org Signed-off-by: Ingo Molnar --- drivers/firmware/efi/libstub/efi-stub-helper.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/firmware/efi/libstub/efi-stub-helper.c b/drivers/firmware/efi/libstub/efi-stub-helper.c index 919822b..3290fae 100644 --- a/drivers/firmware/efi/libstub/efi-stub-helper.c +++ b/drivers/firmware/efi/libstub/efi-stub-helper.c @@ -436,14 +436,14 @@ efi_status_t efi_parse_options(char *cmdline) * Remember, because efi= is also used by the kernel we need to * skip over arguments we don't understand. */ - while (*str) { + while (*str && *str != ' ') { if (!strncmp(str, "nochunk", 7)) { str += strlen("nochunk"); __chunk_size = -1UL; } /* Group words together, delimited by "," */ - while (*str && *str != ',') + while (*str && *str != ' ' && *str != ',') str++; if (*str == ',')