From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1CB43C433FE for ; Wed, 30 Nov 2022 07:37:34 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 3D19485338; Wed, 30 Nov 2022 08:37:32 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="YxzOqDy9"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 8A74085338; Wed, 30 Nov 2022 08:37:30 +0100 (CET) Received: from mail-ej1-x635.google.com (mail-ej1-x635.google.com [IPv6:2a00:1450:4864:20::635]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id A18FC85253 for ; Wed, 30 Nov 2022 08:37:27 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=ilias.apalodimas@linaro.org Received: by mail-ej1-x635.google.com with SMTP id ha10so39308508ejb.3 for ; Tue, 29 Nov 2022 23:37:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=eQ6voivgJa7rP14W+9XWIMBMzovwvMftrUo2wKhKGdg=; b=YxzOqDy9wDhAUPBXvKUKBaP9Z94nAJu32t+BgYsary/+InmqHLLEm0F8Fm1XNVdHME rIBnI6Y2y+jOnStVY52gpbSSoAlprSyv1F7+YiHZ1JsAJGpgjCmKYxOKFVSzIX8xxKyW ZgnqkWJz8mCTAUQVlUw+py4CGfc2ST9Ylwv8XpjSXZt7U6gR8AcxNxhZdykEtLYKboGy q9MYsZ3af8jRQoM4uW01Nwpu5gBeSkSHEFF7yZ5QZiAZnfEeOVFhcWlTSvjFeh4vRvF9 6HdNKfL0CYP0dieu1sGUYbyObVNBDM5lHI4IVU3dCQ0Pt5OQTxmWJJ05hq8WvFLcOQAV ZFOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=eQ6voivgJa7rP14W+9XWIMBMzovwvMftrUo2wKhKGdg=; b=knxIvQzoDF9eikYUeJVC8fF+nHiJRaheZPwKBudT9Ls2QjnrOrsQ6nOpR9V1v0LDqV tOGtU5+AAmqULmMCah1feea3+uDrZRuu4FysCv6+PMxZr6uT6ZBW2XflnycA99rO/6kh uh2he9rTA481Aetc5e33SnLsO6rCbOha1Qqklii0Xdsoabp92uFz8auu13V1BZmYvus5 TfVYXsxIgBJz5InBgtWZnw/MP6pa4Kjs8rcE+TCMCQ1+QLUCMXsURottoqe25DGxmgS2 J2y7XNh/4puEvi2h+XtmXPlVCwfn4RdSLv4nZzUJ/W/4wOuwxleL1f0U4eI3c2++7DPk /3ig== X-Gm-Message-State: ANoB5pm3Ab9O3cX2nbsoMuOOhVeB22rpvyE+xUgk3VPc2TIrpl39Hpdm +f36HwJzlXKBvjODzSOyW4mmKQ== X-Google-Smtp-Source: AA0mqf4+OJpELa/BVEjebo90krXloY15eTlTiG1bE8vw7ZkSiEskT4Zkil03sTjIUmB7AoEJ+I1bdQ== X-Received: by 2002:a17:907:3f8a:b0:7bf:4ae6:c36 with SMTP id hr10-20020a1709073f8a00b007bf4ae60c36mr13242132ejc.674.1669793847228; Tue, 29 Nov 2022 23:37:27 -0800 (PST) Received: from hera (ppp078087234022.access.hol.gr. [78.87.234.22]) by smtp.gmail.com with ESMTPSA id b11-20020a17090630cb00b00781dbdb292asm317690ejb.155.2022.11.29.23.37.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Nov 2022 23:37:26 -0800 (PST) Date: Wed, 30 Nov 2022 09:37:24 +0200 From: Ilias Apalodimas To: Heinrich Schuchardt Cc: u-boot@lists.denx.de Subject: Re: [PATCH 1/1] efi_loader: fix handling of DHCP acknowledge Message-ID: References: <20221126161056.127376-1-heinrich.schuchardt@canonical.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221126161056.127376-1-heinrich.schuchardt@canonical.com> X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean Hi Heinrich, On Sat, Nov 26, 2022 at 05:10:56PM +0100, Heinrich Schuchardt wrote: > The dhcp command may be executed after the first UEFI command. > We should still update the EFI_PXE_BASE_CODE_PROTOCOL. > > Don't leak content of prior acknowledge packages. > > Handle out of memory. > The patch looks correct, but the description is a bit confusing. Apart from what you mention this patch also fixes - An unchecked allocation - shadowing of the global netobj Can we please update the commit message to something that mentions all of these? Thanks /Ilias > Signed-off-by: Heinrich Schuchardt > --- > lib/efi_loader/efi_net.c | 13 ++++++++++--- > 1 file changed, 10 insertions(+), 3 deletions(-) > > diff --git a/lib/efi_loader/efi_net.c b/lib/efi_loader/efi_net.c > index 69276b275d..96a5bcca27 100644 > --- a/lib/efi_loader/efi_net.c > +++ b/lib/efi_loader/efi_net.c > @@ -30,6 +30,7 @@ static uchar **receive_buffer; > static size_t *receive_lengths; > static int rx_packet_idx; > static int rx_packet_num; > +static struct efi_net_obj *netobj; > > /* > * The notification function of this event is called in every timer cycle > @@ -660,10 +661,16 @@ void efi_net_set_dhcp_ack(void *pkt, int len) > { > int maxsize = sizeof(*dhcp_ack); > > - if (!dhcp_ack) > + if (!dhcp_ack) { > dhcp_ack = malloc(maxsize); > - > + if (!dhcp_ack) > + return; > + } > + memset(dhcp_ack, 0, maxsize); > memcpy(dhcp_ack, pkt, min(len, maxsize)); > + > + if (netobj) > + netobj->pxe_mode.dhcp_ack = *dhcp_ack; > } > > /** > @@ -853,7 +860,6 @@ static efi_status_t EFIAPI efi_pxe_base_code_set_packets( > */ > efi_status_t efi_net_register(void) > { > - struct efi_net_obj *netobj = NULL; > efi_status_t r; > int i; > > @@ -982,6 +988,7 @@ failure_to_add_protocol: > return r; > out_of_resources: > free(netobj); > + netobj = NULL; > free(transmit_buffer); > if (receive_buffer) > for (i = 0; i < ETH_PACKETS_BATCH_RECV; i++) > -- > 2.37.2 >