From: P J P <ppandit@redhat.com>
To: Qemu Developers <qemu-devel@nongnu.org>
Cc: Oleksandr Bazhaniuk <oleksandr.bazhaniuk@intel.com>,
Jason Wang <jasowang@redhat.com>,
Prasad J Pandit <pjp@fedoraproject.org>
Subject: [Qemu-devel] [PATCH] net: mipsnet: check packet length against buffer
Date: Thu, 7 Apr 2016 15:56:02 +0530 [thread overview]
Message-ID: <1460024762-14592-1-git-send-email-ppandit@redhat.com> (raw)
From: Prasad J Pandit <pjp@fedoraproject.org>
When receiving packets over MIPSnet network device, it uses
receive buffer of size 1514 bytes. In case the controller
accepts large(MTU) packets, it could lead to memory corruption.
Add check to avoid it.
Reported by: Oleksandr Bazhaniuk <oleksandr.bazhaniuk@intel.com>
Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
---
hw/net/mipsnet.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/hw/net/mipsnet.c b/hw/net/mipsnet.c
index f261011..e134b31 100644
--- a/hw/net/mipsnet.c
+++ b/hw/net/mipsnet.c
@@ -82,6 +82,9 @@ static ssize_t mipsnet_receive(NetClientState *nc, const uint8_t *buf, size_t si
if (!mipsnet_can_receive(nc))
return 0;
+ if (size >= sizeof(s->rx_buffer)) {
+ return 0;
+ }
s->busy = 1;
/* Just accept everything. */
--
2.5.5
next reply other threads:[~2016-04-07 10:26 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-07 10:26 P J P [this message]
2016-04-07 15:44 ` [Qemu-devel] [PATCH] net: mipsnet: check packet length against buffer Markus Armbruster
2016-04-11 7:37 ` P J P
2016-04-11 8:27 ` Jason Wang
2016-04-11 8:51 ` P J P
2016-04-26 7:16 ` Jason Wang
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=1460024762-14592-1-git-send-email-ppandit@redhat.com \
--to=ppandit@redhat.com \
--cc=jasowang@redhat.com \
--cc=oleksandr.bazhaniuk@intel.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).