From 61716249316b825ed2171bc2aa324ac78ea3f3da Mon Sep 17 00:00:00 2001 From: Ard Biesheuvel Date: Thu, 12 Apr 2018 10:59:30 +0200 Subject: Silicon/SynQuacer/NetsecDxe: fix buffer allocation bug 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 --- .../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 b43d1aaff0..0875558c08 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); } -- cgit v1.2.3