Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp1638333yba; Fri, 17 May 2019 02:45:07 -0700 (PDT) X-Google-Smtp-Source: APXvYqzlA9dT/ExyYCDQmw+qjT+Hi3eFylgMpgbcAyYJbeaXg6MjYp7PbGgqaqCafRfA6RJxLWzN X-Received: by 2002:a63:2325:: with SMTP id j37mr55500351pgj.137.1558086307205; Fri, 17 May 2019 02:45:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558086307; cv=none; d=google.com; s=arc-20160816; b=p9gGElchZPObyVx+3f1kIT6vB6mL+/4Es47ZgdoaAYFikTnwoj6vpAJmgC4GcUpbmK W2HMsaHpP1HqBjHOLLe/z5nNFvlw0GsrXr2ecXWoUimyGlmQ9CoPcOTnEH4bRzKkt6DA 5qm7T8K/2HDhOyfkQQSoPBUemjxRCSEQhH82RMSWymkAWB5WZtEeCuoZhBA1Vug+5Z2i WCP0R7ZRwPwh7YmcT2yuP+hEnBiUxmrZGGmk+ABgpNX2e+V2776Auqmo2oy7M5zXm9Ia 73ejpc5nKr4/FJYzGj5PUmaAEXKTWICiVQx6OcuSFzTYGSd70htOPzCzYDjElWIZkFcx Z9fQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=Q1hRjgKSwHweZk8dB5JUfhPlYFrMWm3LL+UTvBdMO2U=; b=CmvV0o3QPAacUdE8pK4GqFuru3w7fKRJByKd+vTOovT73+ytvOuZNl9uoDRSdbFT+w SlDAq6KO3OD1Qi0y0SSLs+fIIvCH0y3GS6g1mOWz4my+xuHixD2EzQBF9EieXRPmpllC E1dq6pnSvco+Yo8Q1wjABafYzb3iBryO0q+9eG/cODmwlDS64JhLABsOOjmkpyP+8LPc MyUnhj6ooZA61HRkj+bNMIMc9wx0u7DqVBsK9INbUV417iurNOzrwTUCd9cF9PZoRzsb OAI+mZFiSO5vdsZnpfL56HNxF6Q0mQJRyoHi00+h8JvSS8J0QqqrNbOZgN0ACpQdY79g iVSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="Kp1Z2DT/"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g9si7639566plb.38.2019.05.17.02.44.52; Fri, 17 May 2019 02:45:07 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="Kp1Z2DT/"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728502AbfEQJYl (ORCPT + 99 others); Fri, 17 May 2019 05:24:41 -0400 Received: from mail-it1-f195.google.com ([209.85.166.195]:39500 "EHLO mail-it1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728394AbfEQJYk (ORCPT ); Fri, 17 May 2019 05:24:40 -0400 Received: by mail-it1-f195.google.com with SMTP id 9so10883436itf.4 for ; Fri, 17 May 2019 02:24:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Q1hRjgKSwHweZk8dB5JUfhPlYFrMWm3LL+UTvBdMO2U=; b=Kp1Z2DT/3W0yLQXVVl4ufLxOAJJlrRiv4Dqcu//FVib0bsRORina1Clxh30Mhe66cK E5D53/P6TIz3VL3qLtK7u8U7Kx1QUWl37ynrZajaq7Eh3j1IwXPKiU0rPNXswc+oXUGB gFPo6rIuBqhwMsQYdXALxUEi23N82f1NPxqLONoccpUJBJw9Uh+o9QbJ6HVEiIKm1ORT cysucRwvJTDop1Z4tDuuUrORv24g/sInMFpyfo73MmJhyg2YUeKkdmY2hlyjjw01BTm7 PVQjYzmZ6ZavAB8o9/m6U9tdt5zXRf65pxGnumjGTeVsZaI4TYyPNSJ50JuldP6pGUVV LSNw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Q1hRjgKSwHweZk8dB5JUfhPlYFrMWm3LL+UTvBdMO2U=; b=RxDJa3sgtR1IbFbgM+/y+53OO2YcabmoZoGvLnBhnaCa/mmDv0abwO3rU6zpJR56Rm Tyq+mAseNsIBZ3GuMDHkXmmyW44k347PcPomMhJB+IDmuiZST+WE0Q93K+Dr/Uqsq1xI ckZwi6D9ClCl/qxKUbKHOWULIUot3t7dCV2zYohaAiPifY6Hd8uC7FDXP1rX3R1g5bMh 2npn+StfKyPV9xL4TiN6xZzLME4pT5hk+ayhgE9ZeN3hW5P3n3MDlNruFq3lzDbzkW1v WUn+rxNue3HRP8H76x+/enxms1FxOPsgAAaKX6tj8qmSHKk32SWmGJbhVfvgeUgWzHMS 4ZaA== X-Gm-Message-State: APjAAAWFtBpugPjpIsI1YX9yQsW7mIUdzNWUluEv+j2dh6Y1gnr9vg36 9puBqrIVo11rR/Cl2Me5bhT8N0IDIF26oiPDtlxrmQ== X-Received: by 2002:a24:d00e:: with SMTP id m14mr15838673itg.153.1558085080212; Fri, 17 May 2019 02:24:40 -0700 (PDT) MIME-Version: 1.0 References: <20190517082633.GA3890@zhanggen-UX430UQ> <20190517090628.GA4162@zhanggen-UX430UQ> In-Reply-To: <20190517090628.GA4162@zhanggen-UX430UQ> From: Ard Biesheuvel Date: Fri, 17 May 2019 11:24:27 +0200 Message-ID: Subject: Re: [PATCH] efi_64: Fix a missing-check bug in arch/x86/platform/efi/efi_64.c of Linux 5.1 To: Gen Zhang , linux-efi Cc: Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 17 May 2019 at 11:06, Gen Zhang wrote: > > On Fri, May 17, 2019 at 10:41:28AM +0200, Ard Biesheuvel wrote: > > Returning an error here is not going to make much difference, given > > that the caller of efi_call_phys_prolog() does not bother to check it, > > and passes the result straight into efi_call_phys_epilog(), which > > happily attempts to dereference it. > > > > So if you want to fix this properly, please fix it at the call site as > > well. I'd prefer to avoid ERR_PTR() and just return NULL for a failed > > allocation though. > Hi Ard, > Thanks for your timely reply! > I think returning NULL in efi_call_phys_prolog() and checking in > efi_call_phys_epilog() is much better. But I am confused what to return > in efi_call_phys_epilog() if save_pgd is NULL. Definitely not return > -ENOMEM, because efi_call_phys_epilog() returns unsigned long. Could > please light on me to fix this problem? If efi_call_phys_prolog() returns NULL, the calling function should abort and never call efi_call_phys_epilog().