* [Qemu-devel] [PATCH for v2.6.0] net: imx: check buffer descriptor length
@ 2016-09-21 13:45 P J P
2016-09-21 16:48 ` Paolo Bonzini
0 siblings, 1 reply; 3+ messages in thread
From: P J P @ 2016-09-21 13:45 UTC (permalink / raw)
To: Qemu Developers; +Cc: Jason Wang, Li Qiang, Prasad J Pandit
From: Prasad J Pandit <pjp@fedoraproject.org>
i.MX Fast Ethernet Controller uses buffer descriptors to manage
data flow to/fro receive & transmit queues. While transmitting
packets, it could continue to read buffer descriptors if a buffer
descriptor has length of zero. Add check to avoid it.
Reported-by: Li Qiang <liqiang6-s@360.cn>
Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
---
hw/net/imx_fec.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/hw/net/imx_fec.c b/hw/net/imx_fec.c
index e60e338..31870b0 100644
--- a/hw/net/imx_fec.c
+++ b/hw/net/imx_fec.c
@@ -276,7 +276,7 @@ static void imx_fec_do_tx(IMXFECState *s)
imx_fec_read_bd(&bd, addr);
FEC_PRINTF("tx_bd %x flags %04x len %d data %08x\n",
addr, bd.flags, bd.length, bd.data);
- if ((bd.flags & FEC_BD_R) == 0) {
+ if (!bd.length || (bd.flags & FEC_BD_R) == 0) {
/* Run out of descriptors to transmit. */
break;
}
--
2.5.5
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH for v2.6.0] net: imx: check buffer descriptor length
2016-09-21 13:45 [Qemu-devel] [PATCH for v2.6.0] net: imx: check buffer descriptor length P J P
@ 2016-09-21 16:48 ` Paolo Bonzini
2016-09-21 17:51 ` P J P
0 siblings, 1 reply; 3+ messages in thread
From: Paolo Bonzini @ 2016-09-21 16:48 UTC (permalink / raw)
To: P J P, Qemu Developers; +Cc: Jason Wang, Li Qiang, Prasad J Pandit
On 21/09/2016 15:45, P J P wrote:
> From: Prasad J Pandit <pjp@fedoraproject.org>
>
> i.MX Fast Ethernet Controller uses buffer descriptors to manage
> data flow to/fro receive & transmit queues. While transmitting
> packets, it could continue to read buffer descriptors if a buffer
> descriptor has length of zero. Add check to avoid it.
>
> Reported-by: Li Qiang <liqiang6-s@360.cn>
> Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
> ---
> hw/net/imx_fec.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/hw/net/imx_fec.c b/hw/net/imx_fec.c
> index e60e338..31870b0 100644
> --- a/hw/net/imx_fec.c
> +++ b/hw/net/imx_fec.c
> @@ -276,7 +276,7 @@ static void imx_fec_do_tx(IMXFECState *s)
> imx_fec_read_bd(&bd, addr);
> FEC_PRINTF("tx_bd %x flags %04x len %d data %08x\n",
> addr, bd.flags, bd.length, bd.data);
> - if ((bd.flags & FEC_BD_R) == 0) {
> + if (!bd.length || (bd.flags & FEC_BD_R) == 0) {
> /* Run out of descriptors to transmit. */
> break;
> }
>
Same here---and same bug as the previous patch too:
diff --git a/hw/net/imx_fec.c b/hw/net/imx_fec.c
index 1c415ab..50c7564 100644
--- a/hw/net/imx_fec.c
+++ b/hw/net/imx_fec.c
@@ -429,7 +429,7 @@ static void imx_fec_do_tx(IMXFECState *s)
frame_size += len;
if (bd.flags & ENET_BD_L) {
/* Last buffer in frame. */
- qemu_send_packet(qemu_get_queue(s->nic), frame, len);
+ qemu_send_packet(qemu_get_queue(s->nic), frame, frame_size);
ptr = frame;
frame_size = 0;
s->regs[ENET_EIR] |= ENET_INT_TXF;
Paolo
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH for v2.6.0] net: imx: check buffer descriptor length
2016-09-21 16:48 ` Paolo Bonzini
@ 2016-09-21 17:51 ` P J P
0 siblings, 0 replies; 3+ messages in thread
From: P J P @ 2016-09-21 17:51 UTC (permalink / raw)
To: Paolo Bonzini; +Cc: Qemu Developers, Jason Wang, Li Qiang
+-- On Wed, 21 Sep 2016, Paolo Bonzini wrote --+
| > diff --git a/hw/net/imx_fec.c b/hw/net/imx_fec.c
| > index e60e338..31870b0 100644
| > --- a/hw/net/imx_fec.c
| > +++ b/hw/net/imx_fec.c
| > @@ -276,7 +276,7 @@ static void imx_fec_do_tx(IMXFECState *s)
| > imx_fec_read_bd(&bd, addr);
| > FEC_PRINTF("tx_bd %x flags %04x len %d data %08x\n",
| > addr, bd.flags, bd.length, bd.data);
| > - if ((bd.flags & FEC_BD_R) == 0) {
| > + if (!bd.length || (bd.flags & FEC_BD_R) == 0) {
| > /* Run out of descriptors to transmit. */
| > break;
| > }
| >
|
| Same here---and same bug as the previous patch too:
Yep, same issue as the other patch.
--
Prasad J Pandit / Red Hat Product Security Team
47AF CE69 3A90 54AA 9045 1053 DD13 3D32 FE5B 041F
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-09-21 17:51 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-21 13:45 [Qemu-devel] [PATCH for v2.6.0] net: imx: check buffer descriptor length P J P
2016-09-21 16:48 ` Paolo Bonzini
2016-09-21 17:51 ` P J P
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.