From patchwork Tue Apr 4 16:02:45 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 96743 Delivered-To: patch@linaro.org Received: by 10.140.89.233 with SMTP id v96csp263296qgd; Tue, 4 Apr 2017 09:03:37 -0700 (PDT) X-Received: by 10.99.177.4 with SMTP id r4mr24476009pgf.16.1491321817046; Tue, 04 Apr 2017 09:03:37 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c1si7404096pge.59.2017.04.04.09.03.36; Tue, 04 Apr 2017 09:03:37 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-efi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-efi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-efi-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932162AbdDDQDe (ORCPT + 2 others); Tue, 4 Apr 2017 12:03:34 -0400 Received: from mail-wm0-f50.google.com ([74.125.82.50]:37421 "EHLO mail-wm0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932122AbdDDQDd (ORCPT ); Tue, 4 Apr 2017 12:03:33 -0400 Received: by mail-wm0-f50.google.com with SMTP id x124so32352428wmf.0 for ; Tue, 04 Apr 2017 09:03:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=ff4hQUtQmqYHUaLpVoZ9JEJ65lK1TiqAHW+FNJv26tA=; b=cibboHqjmh7kl3lIgwxB3ZP4HZacLJE0yOeTsSOmrg+IP1tJzgVpMNE3hTEw5C+PLW 1werf3bPocQKuPSrIe/ElZRtGatt/S8KGFU7UA6ueToGUngP8Y/pElC1mNXzZS+drysl FflBw+dYvIdRiWjFE2Z7AeC6FRSNYGwo/opV0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=ff4hQUtQmqYHUaLpVoZ9JEJ65lK1TiqAHW+FNJv26tA=; b=FD1a8CKUahuwmq4R+to+At4ULfvTtzNieH7klB6McjtImfkAez0+sQYYkfQD171sxG of1jJVQazMxgdE8GcB2Vb6HbCkf1MCd4CQMVjJFGFg/AqBZ4FRkTiwZk8COwijmGEfhB srNsofe6DLBHG+MsVEiQAwm1imNEU09Qh9Bmf4diRQYyycGc5geejg+E2qABVVsHu1DG DG4NNlaPHiug0s/0K4hDj1e/yeGEF2QKybGT7RQv2A5OaWg/1NeAEKSbXIojcJ2x3hUo WlO+6PA2H+oQvGtW1/F/4JyAgXWIqG3ucFnqTxVkFa3HSaQefiqpByTaldRTtcQiV1NY WmGA== X-Gm-Message-State: AFeK/H2/7G1pPGYTK9JnZDh0vo4g+0WQHpw22fYsrk92Ij1TX+HndyZI 2VmhLV03yhD6goXB X-Received: by 10.28.73.197 with SMTP id w188mr15233557wma.46.1491321811967; Tue, 04 Apr 2017 09:03:31 -0700 (PDT) Received: from localhost.localdomain ([160.163.145.113]) by smtp.gmail.com with ESMTPSA id z88sm19686465wrb.1.2017.04.04.09.03.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 04 Apr 2017 09:03:31 -0700 (PDT) From: Ard Biesheuvel To: linux-efi@vger.kernel.org, Ingo Molnar , Thomas Gleixner , "H . Peter Anvin" Cc: Ard Biesheuvel , linux-kernel@vger.kernel.org Subject: [PATCH 09/12] efi/libstub: Fix harmless command line parsing bug Date: Tue, 4 Apr 2017 17:02:45 +0100 Message-Id: <20170404160245.27812-12-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170404160245.27812-1-ard.biesheuvel@linaro.org> References: <20170404160245.27812-1-ard.biesheuvel@linaro.org> Sender: linux-efi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-efi@vger.kernel.org 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. Cc: Matt Fleming Signed-off-by: Ard Biesheuvel --- drivers/firmware/efi/libstub/efi-stub-helper.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.9.3 -- To unsubscribe from this list: send the line "unsubscribe linux-efi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/firmware/efi/libstub/efi-stub-helper.c b/drivers/firmware/efi/libstub/efi-stub-helper.c index 919822b7773d..3290fae0b38f 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 == ',')