From patchwork Wed Jul 2 10:10:01 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 32962 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ie0-f200.google.com (mail-ie0-f200.google.com [209.85.223.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 3063720672 for ; Wed, 2 Jul 2014 10:12:31 +0000 (UTC) Received: by mail-ie0-f200.google.com with SMTP id tr6sf67195936ieb.7 for ; Wed, 02 Jul 2014 03:12:30 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:subject:date:message-id:cc :precedence:list-id:list-unsubscribe:list-archive:list-post :list-help:list-subscribe:mime-version:sender:errors-to :x-original-sender:x-original-authentication-results:mailing-list :content-type:content-transfer-encoding; bh=qii20D5sifUr84bIhvDwfQPYvlEYFm8FDXFS1UOWmyA=; b=VtwHmMBbtNKDk4+ckzyXcAskHYGsxUEEBn1zkm/tePA+bJw03y299BwrxiJt30zaAC mfbKuiL8uyC5S4rNbKLz0KQSon7TaORR+Qcg7Cf17duypb4tx+RaOICd21GxULVGTfCj sClpu9Zw0OaJMObJLV6EGIQ+7mWNmmc8wW4IPs1Ul6jSmaRwySmkiN0Vcku9n1izvh7p QrJP4x357BNolctair4cMxSNj/tvV3icnMXQoYF93tAKuu8M/vFFbCCSIIggIaIHNUCu lpTDPBxDU9qNl/A9jhTgQ+V/9zZ+UKEUSzereSCf5lsvtqJ5wMao2IBZ1pINjR2yQ25X L6dw== X-Gm-Message-State: ALoCoQnvIvROjfjM0KG0jiuzgXalrsOZFtmkqiUu+UCFkZrFAZC1pCNwT8a0oSt28Ohiy3F9QiDH X-Received: by 10.182.115.133 with SMTP id jo5mr29839365obb.38.1404295950684; Wed, 02 Jul 2014 03:12:30 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.32.203 with SMTP id h69ls2486453qgh.56.gmail; Wed, 02 Jul 2014 03:12:30 -0700 (PDT) X-Received: by 10.220.177.133 with SMTP id bi5mr42966856vcb.26.1404295950584; Wed, 02 Jul 2014 03:12:30 -0700 (PDT) Received: from mail-vc0-f179.google.com (mail-vc0-f179.google.com [209.85.220.179]) by mx.google.com with ESMTPS id xn6si12672434vdb.57.2014.07.02.03.12.30 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 02 Jul 2014 03:12:30 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.179 as permitted sender) client-ip=209.85.220.179; Received: by mail-vc0-f179.google.com with SMTP id id10so10156515vcb.38 for ; Wed, 02 Jul 2014 03:12:30 -0700 (PDT) X-Received: by 10.220.177.133 with SMTP id bi5mr42966851vcb.26.1404295950483; Wed, 02 Jul 2014 03:12:30 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.221.37.5 with SMTP id tc5csp281610vcb; Wed, 2 Jul 2014 03:12:30 -0700 (PDT) X-Received: by 10.66.255.67 with SMTP id ao3mr63845986pad.25.1404295949433; Wed, 02 Jul 2014 03:12:29 -0700 (PDT) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id dn5si19733719pbd.25.2014.07.02.03.12.28 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 02 Jul 2014 03:12:29 -0700 (PDT) Received-SPF: none (google.com: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org does not designate permitted sender hosts) client-ip=2001:1868:205::9; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1X2HUp-0002UO-B9; Wed, 02 Jul 2014 10:10:35 +0000 Received: from mail-we0-f180.google.com ([74.125.82.180]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1X2HUm-0002OG-D7 for linux-arm-kernel@lists.infradead.org; Wed, 02 Jul 2014 10:10:32 +0000 Received: by mail-we0-f180.google.com with SMTP id x48so11001259wes.11 for ; Wed, 02 Jul 2014 03:10:09 -0700 (PDT) X-Received: by 10.180.108.133 with SMTP id hk5mr3353883wib.77.1404295808895; Wed, 02 Jul 2014 03:10:08 -0700 (PDT) Received: from ards-macbook-pro.local ([37.183.67.249]) by mx.google.com with ESMTPSA id hq20sm1966801wib.0.2014.07.02.03.10.06 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 02 Jul 2014 03:10:08 -0700 (PDT) From: Ard Biesheuvel To: matt.fleming@intel.com, x86@kernel.org Subject: [PATCH 1/2] efi/arm64: fix potential NULL dereference of efi.systab Date: Wed, 2 Jul 2014 12:10:01 +0200 Message-Id: <1404295802-28030-1-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 1.8.3.2 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140702_031032_596028_460E7223 X-CRM114-Status: GOOD ( 10.63 ) X-Spam-Score: -0.7 (/) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-0.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record -0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [74.125.82.180 listed in wl.mailspike.net] -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [74.125.82.180 listed in list.dnswl.org] -0.0 RCVD_IN_MSPIKE_WL Mailspike good senders Cc: linux-efi@vger.kernel.org, Ard Biesheuvel , catalin.marinas@arm.com, msalter@redhat.com, leif.lindholm@linaro.org, roy.franz@linaro.org, hpa@zytor.com, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: ard.biesheuvel@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.179 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 We assign efi.systab using efi_lookup_mapped_addr(), and test for !NULL, but then go on an dereference it anyway. Signed-off-by: Ard Biesheuvel --- arch/arm64/kernel/efi.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/arch/arm64/kernel/efi.c b/arch/arm64/kernel/efi.c index 56c3327bbf79..e785f93f17cb 100644 --- a/arch/arm64/kernel/efi.c +++ b/arch/arm64/kernel/efi.c @@ -419,8 +419,11 @@ static int __init arm64_enter_virtual_mode(void) } efi.systab = (__force void *)efi_lookup_mapped_addr(efi_system_table); - if (efi.systab) - set_bit(EFI_SYSTEM_TABLES, &efi.flags); + if (!efi.systab) { + pr_err("Failed to remap EFI System Table!\n"); + return -1; + } + set_bit(EFI_SYSTEM_TABLES, &efi.flags); local_irq_save(flags); cpu_switch_mm(idmap_pg_dir, &init_mm);