From: Jason Wang <jasowang@redhat.com>
To: chaojianhu <chaojianhu@hotmail.com>, qemu-devel@nongnu.org
Cc: qemu-trivial@nongnu.org, edgar.iglesias@gmail.com,
alistair.francis@xilinx.com, qemu-arm@nongnu.org
Subject: Re: [Qemu-trivial] [PATCH] hw/net: Fix a heap overflow in xlnx.xps-ethernetlite
Date: Tue, 9 Aug 2016 15:26:52 +0800 [thread overview]
Message-ID: <a00d4a5d-02f4-51a5-cad4-ec6018a30f96@redhat.com> (raw)
In-Reply-To: <BLU436-SMTP98842C445B9A4E4B033261DB1C0@phx.gbl>
On 2016年08月09日 11:52, chaojianhu wrote:
> The .receive callback of xlnx.xps-ethernetlite doesn't check the length
> of data before calling memcpy. As a result, the NetClientState object in
> heap will be overflowed. All versions of qemu with xlnx.xps-ethernetlite
> will be affected.
>
> Reported-by: chaojianhu <chaojianhu@hotmail.com>
> Signed-off-by: chaojianhu <chaojianhu@hotmail.com>
>
> ---
> hw/net/xilinx_ethlite.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/hw/net/xilinx_ethlite.c b/hw/net/xilinx_ethlite.c
> index 54db2b8..35de353 100644
> --- a/hw/net/xilinx_ethlite.c
> +++ b/hw/net/xilinx_ethlite.c
> @@ -197,6 +197,10 @@ static ssize_t eth_rx(NetClientState *nc, const uint8_t *buf, size_t size)
> }
>
> D(qemu_log("%s %zd rxbase=%x\n", __func__, size, rxbase));
> + if (size > (R_MAX - R_RX_BUF0 - rxbase) * 4) {
> + D(qemu_log("ethlite packet is too big, size=%x\n", size));
> + return -1;
> + }
> memcpy(&s->regs[rxbase + R_RX_BUF0], buf, size);
>
> s->regs[rxbase + R_RX_CTRL0] |= CTRL_S;
Applied, thanks.
next prev parent reply other threads:[~2016-08-09 7:27 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-09 3:52 [Qemu-trivial] [PATCH] hw/net: Fix a heap overflow in xlnx.xps-ethernetlite chaojianhu
2016-08-09 7:26 ` Jason Wang [this message]
-- strict thread matches above, loose matches on Subject: below --
2016-08-09 2:24 chaojianhu
2016-08-09 3:51 ` 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=a00d4a5d-02f4-51a5-cad4-ec6018a30f96@redhat.com \
--to=jasowang@redhat.com \
--cc=alistair.francis@xilinx.com \
--cc=chaojianhu@hotmail.com \
--cc=edgar.iglesias@gmail.com \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-trivial@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).