* [PATCH edk2-platforms] Silicon/SynQuacer/NetsecDxe: fix buffer allocation bug
@ 2018-04-12 9:23 Ard Biesheuvel
2018-04-19 10:44 ` Leif Lindholm
0 siblings, 1 reply; 3+ messages in thread
From: Ard Biesheuvel @ 2018-04-12 9:23 UTC (permalink / raw)
To: edk2-devel
Cc: leif.lindholm, okamoto.satoru, graeme.gregory, daniel.thompson,
jaswinder.singh, masami.hiramatsu, renato.golin, masahisa.kojima,
bill.fletcher, linarobox, Ard Biesheuvel
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 <ard.biesheuvel@linaro.org>
---
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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH edk2-platforms] Silicon/SynQuacer/NetsecDxe: fix buffer allocation bug
2018-04-12 9:23 [PATCH edk2-platforms] Silicon/SynQuacer/NetsecDxe: fix buffer allocation bug Ard Biesheuvel
@ 2018-04-19 10:44 ` Leif Lindholm
2018-04-19 12:53 ` Ard Biesheuvel
0 siblings, 1 reply; 3+ messages in thread
From: Leif Lindholm @ 2018-04-19 10:44 UTC (permalink / raw)
To: Ard Biesheuvel
Cc: edk2-devel, okamoto.satoru, graeme.gregory, daniel.thompson,
jaswinder.singh, masami.hiramatsu, renato.golin, masahisa.kojima,
bill.fletcher, linarobox
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 <ard.biesheuvel@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
> ---
> 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
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH edk2-platforms] Silicon/SynQuacer/NetsecDxe: fix buffer allocation bug
2018-04-19 10:44 ` Leif Lindholm
@ 2018-04-19 12:53 ` Ard Biesheuvel
0 siblings, 0 replies; 3+ messages in thread
From: Ard Biesheuvel @ 2018-04-19 12:53 UTC (permalink / raw)
To: Leif Lindholm
Cc: edk2-devel@lists.01.org, Satoru Okamoto, Graeme Gregory,
Daniel Thompson, Jaswinder Singh, Masami Hiramatsu, Renato Golin,
Masahisa Kojima, Bill Fletcher, linarobox
On 19 April 2018 at 12:44, Leif Lindholm <leif.lindholm@linaro.org> wrote:
> 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 <ard.biesheuvel@linaro.org>
>
> Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
>
Thanks
Pushed as 61716249316b
>> ---
>> 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
>>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-04-19 12:53 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-04-12 9:23 [PATCH edk2-platforms] Silicon/SynQuacer/NetsecDxe: fix buffer allocation bug Ard Biesheuvel
2018-04-19 10:44 ` Leif Lindholm
2018-04-19 12:53 ` Ard Biesheuvel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox