qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Aurelien Jarno <aurelien@aurel32.net>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: P J P <ppandit@redhat.com>,
	Qemu Developers <qemu-devel@nongnu.org>,
	Jason Wang <jasowang@redhat.com>, Li Qiang <liqiang6-s@360.cn>,
	Prasad J Pandit <pjp@fedoraproject.org>,
	Leon Alrae <leon.alrae@imgtec.com>
Subject: Re: [Qemu-devel] [PATCH] net: mipsnet: check transmit buffer size before sending
Date: Mon, 13 Jun 2016 10:35:17 +0200	[thread overview]
Message-ID: <20160613083517.GB16232@aurel32.net> (raw)
In-Reply-To: <CAFEAcA_a1nRknWwbu4SS2ehMp6o-4OgOQoTntRbSM5fSD3RVZw@mail.gmail.com>

On 2016-06-02 10:28, Peter Maydell wrote:
> On 2 June 2016 at 07:44, P J P <ppandit@redhat.com> wrote:
> > From: Prasad J Pandit <pjp@fedoraproject.org>
> >
> > When processing MIPSnet I/O port write operation, it uses a
> > transmit buffer tx_buffer[MAX_ETH_FRAME_SIZE=1514]. Two indices
> > 's->tx_written' and 's->tx_count' are used to control data written
> > to this buffer. If the two were to be equal before writing, it'd
> > lead to an OOB write access beyond tx_buffer. Add check to avoid it.
> >
> > Reported-by: Li Qiang <liqiang6-s@360.cn>
> > Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
> > ---
> >  hw/net/mipsnet.c | 10 ++++++----
> >  1 file changed, 6 insertions(+), 4 deletions(-)
> >
> > diff --git a/hw/net/mipsnet.c b/hw/net/mipsnet.c
> > index 740cd98..8d5e5bf 100644
> > --- a/hw/net/mipsnet.c
> > +++ b/hw/net/mipsnet.c
> > @@ -158,7 +158,7 @@ static void mipsnet_ioport_write(void *opaque, hwaddr addr,
> >      trace_mipsnet_write(addr, val);
> >      switch (addr) {
> >      case MIPSNET_TX_DATA_COUNT:
> > -       s->tx_count = (val <= MAX_ETH_FRAME_SIZE) ? val : 0;
> > +        s->tx_count = (val < MAX_ETH_FRAME_SIZE) ? val : MAX_ETH_FRAME_SIZE;
> >          s->tx_written = 0;
> 
> This is a behaviour change -- the register will now read
> back as MAX_ETH_FRAME_SIZE rather than 0 if written with
> an overlarge value.
> 
> Do we have any documentation on how this (simulated)
> device is supposed to behave in this case?

This device is not supported by the linux kernel for more than 2.5 years
(since v3.7). Do we want to keep this device in QEMU? 

Aurelien

-- 
Aurelien Jarno                          GPG: 4096R/1DDD8C9B
aurelien@aurel32.net                 http://www.aurel32.net

  parent reply	other threads:[~2016-06-13  8:35 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-02  6:44 [Qemu-devel] [PATCH] net: mipsnet: check transmit buffer size before sending P J P
2016-06-02  9:28 ` Peter Maydell
2016-06-02 19:45   ` P J P
2016-06-07  5:02     ` P J P
2016-06-08  6:38       ` Jason Wang
2016-06-08  7:47         ` P J P
2016-06-13  8:35   ` Aurelien Jarno [this message]
2016-06-14  3:48     ` 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=20160613083517.GB16232@aurel32.net \
    --to=aurelien@aurel32.net \
    --cc=jasowang@redhat.com \
    --cc=leon.alrae@imgtec.com \
    --cc=liqiang6-s@360.cn \
    --cc=peter.maydell@linaro.org \
    --cc=pjp@fedoraproject.org \
    --cc=ppandit@redhat.com \
    --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).