From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a00:1450:400c:c0c::242; helo=mail-wr0-x242.google.com; envelope-from=leif.lindholm@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-wr0-x242.google.com (mail-wr0-x242.google.com [IPv6:2a00:1450:400c:c0c::242]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 1B565226847A6 for ; Thu, 19 Apr 2018 03:45:00 -0700 (PDT) Received: by mail-wr0-x242.google.com with SMTP id h3-v6so12734547wrh.5 for ; Thu, 19 Apr 2018 03:44:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=5VK5zBZDZMcGeb0gre3CgTUBr+gY9F7aaOgsZaCZOkc=; b=B4NR5nF/WyQU1L6x4L7VbLY6rlosw/f76uXovfoNZv0ZUtknSl7vtc0u6G19+DqGjV xenaWe6LdSDZlzDkAA9pgNBu1/WwvxXJXpujz7STGD17Ionw/zcBcJn8CuJ0RMSk641/ ZipFFArqeKPul2C5+fanbxY26kG5hO3+rE+SA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=5VK5zBZDZMcGeb0gre3CgTUBr+gY9F7aaOgsZaCZOkc=; b=jlxJvBqUGyzYpe5SJQMb85Zv5BJ7VYal98eV/3fezSuFRWggjMoAV7e8vgtRGRQHqJ PD8qDaaAauiOUbklkNrP1DVPdK2H+686rDbPk11KNt2TpVZpMM3LQTYKPkK1VZj1Rmrl BnvK1teGqmdlY1RuelQfanO/6cHQgJaDVyZvcIvvVIDgOuHptR6uSkhf3FKFZdzQ9Ee6 ZV02ZgNZAAdxyc9uXHt0MIVnpl39G5amSnCWp1ukdDr1JvgHh8g1oqKdLxXKsCk6Zi27 xk8NzCzAIqK07N+3ptnq8eRbPJwFX3+9eiq7q3JvXGMZLca6Wrq/pLgYi5dqGdodG70X mOjA== X-Gm-Message-State: ALQs6tBLrb2xrUf3MDDyMRy9rY8MMvFMtXIgAecwJIxehfIaC9YTsRW2 flGdr4i+uP8L9TmXmDd4fdBrLg== X-Google-Smtp-Source: AIpwx488UWp4CxSwgsWNR6X9Y7HFy8Qj4Gxlb1o7jibSkECCnSAgIcoyMe8aCoX40VS+W+/+thspXQ== X-Received: by 10.28.114.9 with SMTP id n9mr3963637wmc.147.1524134698604; Thu, 19 Apr 2018 03:44:58 -0700 (PDT) Received: from bivouac.eciton.net (bivouac.eciton.net. [2a00:1098:0:86:1000:23:0:2]) by smtp.gmail.com with ESMTPSA id i44-v6sm2965586wri.17.2018.04.19.03.44.57 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 19 Apr 2018 03:44:57 -0700 (PDT) Date: Thu, 19 Apr 2018 11:44:56 +0100 From: Leif Lindholm To: Ard Biesheuvel Cc: edk2-devel@lists.01.org, okamoto.satoru@socionext.com, graeme.gregory@linaro.org, daniel.thompson@linaro.org, jaswinder.singh@linaro.org, masami.hiramatsu@linaro.org, renato.golin@linaro.org, masahisa.kojima@linaro.org, bill.fletcher@linaro.org, linarobox@linaro.org Message-ID: <20180419104456.3wpefk2na62cngif@bivouac.eciton.net> References: <20180412092349.8680-1-ard.biesheuvel@linaro.org> MIME-Version: 1.0 In-Reply-To: <20180412092349.8680-1-ard.biesheuvel@linaro.org> User-Agent: NeoMutt/20170113 (1.7.2) Subject: Re: [PATCH edk2-platforms] Silicon/SynQuacer/NetsecDxe: fix buffer allocation bug X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Apr 2018 10:45:00 -0000 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Thu, Apr 12, 2018 at 11:23:49AM +0200, Ard Biesheuvel wrote: > The receive buffers of the NETSEC driver are owned by the driver itself > (as opposed to the protocol client in the case of the transmit path), > and so the descriptors and the buffers (which are of a fixed size) are > allocated in one go. The idea is that the 'buffer' member of the > descriptor should point to a DMA aligned offset into the same allocation, > but the code in pfdep_alloc_pkt_buf() calculates the value incorrectly, > resulting in corruption of the descriptor metadata if the pool allocation > happens to be DMA aligned. > > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Ard Biesheuvel Reviewed-by: Leif Lindholm > --- > Silicon/Socionext/SynQuacer/Drivers/Net/NetsecDxe/netsec_for_uefi/pfdep_uefi.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/Silicon/Socionext/SynQuacer/Drivers/Net/NetsecDxe/netsec_for_uefi/pfdep_uefi.c b/Silicon/Socionext/SynQuacer/Drivers/Net/NetsecDxe/netsec_for_uefi/pfdep_uefi.c > index b43d1aaff037..0875558c08ea 100644 > --- a/Silicon/Socionext/SynQuacer/Drivers/Net/NetsecDxe/netsec_for_uefi/pfdep_uefi.c > +++ b/Silicon/Socionext/SynQuacer/Drivers/Net/NetsecDxe/netsec_for_uefi/pfdep_uefi.c > @@ -134,7 +134,7 @@ pfdep_alloc_pkt_buf ( > return PFDEP_ERR_ALLOC; > } > > - (*pkt_handle_p)->Buffer = ALIGN_POINTER (*pkt_handle_p, > + (*pkt_handle_p)->Buffer = ALIGN_POINTER (*pkt_handle_p + 1, > mCpu->DmaBufferAlignment); > } > > -- > 2.17.0 >