Re: [Qemu-devel] [PATCH] net: cadence_gem: check packet size in gem_recieve

2016-01-17 Thread Jason Wang
On 01/18/2016 01:34 PM, P J P wrote: > +-- On Mon, 18 Jan 2016, Jason Wang wrote --+ > | > +if (size > sizeof(rxbuf) - sizeof(crc_val)) { > | > +size = sizeof(rxbuf) - sizeof(crc_val); > | > +} > | > +bytes_to_copy = size; > | > + > | > | We probably need more

Re: [Qemu-devel] [PATCH] net: cadence_gem: check packet size in gem_recieve

2016-01-17 Thread P J P
+-- On Mon, 18 Jan 2016, Jason Wang wrote --+ | > +if (size > sizeof(rxbuf) - sizeof(crc_val)) { | > +size = sizeof(rxbuf) - sizeof(crc_val); | > +} | > +bytes_to_copy = size; | > + | | We probably need more check, is there any guarantee that size <= 2048? | If

Re: [Qemu-devel] [PATCH] net: cadence_gem: check packet size in gem_recieve

2016-01-17 Thread Jason Wang
On 01/15/2016 03:00 PM, P J P wrote: > From: Prasad J Pandit > > While receiving packets in 'gem_receive' routine, if Frame Check > Sequence(FCS) is enabled, it copies the packet into a local > buffer without checking its size. Add check to validate packet > length against the buffer size to avo

[Qemu-devel] [PATCH] net: cadence_gem: check packet size in gem_recieve

2016-01-14 Thread P J P
From: Prasad J Pandit While receiving packets in 'gem_receive' routine, if Frame Check Sequence(FCS) is enabled, it copies the packet into a local buffer without checking its size. Add check to validate packet length against the buffer size to avoid buffer overflow. Reported-by: Ling Liu Signed