From: P J P <ppandit@redhat.com>
To: Qemu Developers <qemu-devel@nongnu.org>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
Jason Wang <jasowang@redhat.com>, Li Qiang <liqiang6-s@360.cn>,
Prasad J Pandit <pjp@fedoraproject.org>
Subject: [Qemu-devel] [PATCH v2] net: imx: limit buffer descriptor count
Date: Thu, 22 Sep 2016 16:01:38 +0530 [thread overview]
Message-ID: <1474540298-4152-1-git-send-email-ppandit@redhat.com> (raw)
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 and has crafted values in bd.flags.
Set an upper limit to number of buffer descriptors.
Reported-by: Li Qiang <liqiang6-s@360.cn>
Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
---
hw/net/imx_fec.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
Update per
-> https://lists.gnu.org/archive/html/qemu-devel/2016-09/msg05284.html
diff --git a/hw/net/imx_fec.c b/hw/net/imx_fec.c
index e60e338..547fa99 100644
--- a/hw/net/imx_fec.c
+++ b/hw/net/imx_fec.c
@@ -94,6 +94,8 @@ static const VMStateDescription vmstate_imx_fec = {
#define PHY_INT_PARFAULT (1 << 2)
#define PHY_INT_AUTONEG_PAGE (1 << 1)
+#define IMX_MAX_DESC 1024
+
static void imx_fec_update(IMXFECState *s);
/*
@@ -264,12 +266,12 @@ static void imx_fec_update(IMXFECState *s)
static void imx_fec_do_tx(IMXFECState *s)
{
- int frame_size = 0;
+ int frame_size = 0, descnt = 0;
uint8_t frame[FEC_MAX_FRAME_SIZE];
uint8_t *ptr = frame;
uint32_t addr = s->tx_descriptor;
- while (1) {
+ while (descnt++ < IMX_MAX_DESC) {
IMXFECBufDesc bd;
int len;
--
2.5.5
next reply other threads:[~2016-09-22 10:31 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-22 10:31 P J P [this message]
2016-09-22 10:32 ` [Qemu-devel] [PATCH v2] net: imx: limit buffer descriptor count Paolo Bonzini
2016-09-23 5:17 ` Jason Wang
2016-09-23 6:08 ` Jason Wang
2016-09-26 10:51 ` P J P
2017-01-26 17:48 ` P J P
2017-02-02 9:51 ` P J P
2017-02-02 11:05 ` P J P
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1474540298-4152-1-git-send-email-ppandit@redhat.com \
--to=ppandit@redhat.com \
--cc=jasowang@redhat.com \
--cc=liqiang6-s@360.cn \
--cc=pbonzini@redhat.com \
--cc=pjp@fedoraproject.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).