From patchwork Thu Apr 12 09:23:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 133193 Delivered-To: patch@linaro.org Received: by 10.46.84.29 with SMTP id i29csp1492949ljb; Thu, 12 Apr 2018 02:24:54 -0700 (PDT) X-Google-Smtp-Source: AIpwx49kAERNytbYoadlVXnzuaAPIYTSOeWPHg7Y7anUCByte1tbUFNlRYvwUXk60I9DRjySMznv X-Received: by 2002:a17:902:9a48:: with SMTP id x8-v6mr158005plv.135.1523525094582; Thu, 12 Apr 2018 02:24:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523525094; cv=none; d=google.com; s=arc-20160816; b=DJ8LD2hU4Pp/YXn44pD0NVBBESwHRINrF80QVKodnplrLKyYDyny8cBewurt5uu1BZ VCcloSuV1kkq2VeRs8+cSfrGMGgB/AX30lGzbblBViqo6iOTUrlEMCIcBF8VWB+zba4y oIurgozV6xFuXdot26yB6mwzmvyedV9QmDGvJZ4od0xS9A7qoTyApdhy/e2YjcDyz+YE VNZZXdWTJkCiU9nSkK4dwmMtDnci3ztXjvoOhS8407W2MVwqgt8vkmJ7+15MwFmUUDxn rsbSGvLmEjvR34/ikezQtfEB2FioVP7srQ19oiZ/StUfAef7wPA+F9S0Ae5O2v/PUutS 7hSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:message-id:date:to:from:dkim-signature :delivered-to:arc-authentication-results; bh=jczAk2KHYs4pdUBPZvOk/G+W7mybItxxYrb55jUyyeo=; b=xVJJyoG4ifMa8n0YNgYAvKqZTareSMl9U49EIMqhuS7unb07/ZWUdxs26zi7LWPn4a qJDvaPIaJkcAt/GGqUVLS9aOj1ypcSLj9oNofBgUJl34iaKaYUFUW0H2BQstOv7nq8Qr p7gdvRbYhmXJuDHeOIHA7KsyGhu9lNasiQUv7CpXcd2sCH/0O44JHE9AIvr/2OvaFyEh PhXyvBGbIpywqWZ6zfUhRf2P2jh7nVb0if/tZA0UWcI4wNdtmQfp583hqtp1v2Awpbgq FVPUMTO6K2twHE92cq6BKCZWHPoMive6OIWM88jdqxfGoXgvzNypVXnfZETKkm9yvRwo vIXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=hAlLrBFn; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from ml01.01.org (ml01.01.org. [198.145.21.10]) by mx.google.com with ESMTPS id a1-v6si2957678plt.693.2018.04.12.02.24.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 12 Apr 2018 02:24:54 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) client-ip=198.145.21.10; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=hAlLrBFn; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id EE667226EAC9F; Thu, 12 Apr 2018 02:24:53 -0700 (PDT) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a00:1450:400c:c0c::242; helo=mail-wr0-x242.google.com; envelope-from=ard.biesheuvel@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 91424226EAC7B for ; Thu, 12 Apr 2018 02:24:52 -0700 (PDT) Received: by mail-wr0-x242.google.com with SMTP id q13so960639wre.3 for ; Thu, 12 Apr 2018 02:24:52 -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; bh=j7RdsBkUkgyEbIRaWRi3tEea1A/Jh3ZFrSqkozeHQlw=; b=hAlLrBFnPehsoIUJ70J4TmTKq63wTA2jMmnjjRQo3xz2drYWt/UxRVbaDnYaDoDT/+ Jja/vo3hYcMjSlhNH2b8IgnIfks0guP4zkMCHa9nPbH33D0jl5Ze2I/5V1nlWxInmJv5 No6yrtKdPiGmq90AzPCi3F0fH1O+9y+ytF8Po= 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; bh=j7RdsBkUkgyEbIRaWRi3tEea1A/Jh3ZFrSqkozeHQlw=; b=RZZJSMZ6QDwge6vXa4mHfdw2+OK218LQxakpGRUYtQdlsrv/dG0r8KCUR/S713SOUA FgpFUXdZMm7AH6nBDmsBpdGYAHv0OgjNyG0Ldjk85jGUfEJeqeInnUWJyC41ta32ClT4 160Dy/RiSeTmniEyO50zoMq35KDauYjiEshuEki3ZlSlMytsfBfjlHTiPeNlS5F2FDyu v1WmyNFoJ3I6bIzQqHKMZkhUr4k5zu1n8rqASvXnh0julerY+gbBY8dDM23+yXnFCF9g Z6XC4o955eyIta8Zc60KYqLR+eaS1uchzf1PycnNWY1e2T/UDjPAJW+rCn1rDqgUc2Zz qdgA== X-Gm-Message-State: ALQs6tAVCdm0FWUY1UZx5GIq3h8T8LhZOjHnDTXmAAI54n6gz/lmIabL Z799wG3v5whBphdMLDLTvCkrunyJOZ4= X-Received: by 10.223.226.208 with SMTP id d16mr183891wrj.50.1523525089849; Thu, 12 Apr 2018 02:24:49 -0700 (PDT) Received: from localhost.localdomain ([2a01:e35:3995:5470:200:1aff:fe1b:b328]) by smtp.gmail.com with ESMTPSA id w14sm726748wmd.1.2018.04.12.02.24.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 12 Apr 2018 02:24:48 -0700 (PDT) From: Ard Biesheuvel To: edk2-devel@lists.01.org Date: Thu, 12 Apr 2018 11:23:49 +0200 Message-Id: <20180412092349.8680-1-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.17.0 Subject: [edk2] [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: , Cc: renato.golin@linaro.org, daniel.thompson@linaro.org, masami.hiramatsu@linaro.org, bill.fletcher@linaro.org, linarobox@linaro.org, Ard Biesheuvel , leif.lindholm@linaro.org, jaswinder.singh@linaro.org, masahisa.kojima@linaro.org, okamoto.satoru@socionext.com MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" 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 --- Silicon/Socionext/SynQuacer/Drivers/Net/NetsecDxe/netsec_for_uefi/pfdep_uefi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.17.0 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel Reviewed-by: Leif Lindholm 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); }