From: Peter Maydell <peter.maydell@linaro.org>
To: Stefan Hajnoczi <stefanha@redhat.com>
Cc: qemu-devel@nongnu.org, Jason Wang <jasowang@redhat.com>,
Alexander Bulekov <alxndr@bu.edu>
Subject: Re: [PATCH] rtl8139: fix large_send_mss divide-by-zero
Date: Thu, 13 Apr 2023 19:24:17 +0100 [thread overview]
Message-ID: <CAFEAcA8J4zWVL=dBAY1KYxU_im392xU1rU=GN=yQKhG6Og=SAQ@mail.gmail.com> (raw)
In-Reply-To: <20230413171946.2865726-1-stefanha@redhat.com>
On Thu, 13 Apr 2023 at 18:21, Stefan Hajnoczi <stefanha@redhat.com> wrote:
>
> If the driver sets large_send_mss to 0 then a divide-by-zero occurs.
> Even if the division wasn't a problem, the for loop that emits MSS-sized
> packets would never terminate.
>
> Solve these issues by skipping offloading when large_send_mss=0.
> diff --git a/hw/net/rtl8139.c b/hw/net/rtl8139.c
> index 5a5aaf868d..5f1a4d359b 100644
> --- a/hw/net/rtl8139.c
> +++ b/hw/net/rtl8139.c
> @@ -2154,6 +2154,9 @@ static int rtl8139_cplus_transmit_one(RTL8139State *s)
>
> int large_send_mss = (txdw0 >> CP_TC_LGSEN_MSS_SHIFT) &
> CP_TC_LGSEN_MSS_MASK;
> + if (large_send_mss == 0) {
> + goto skip_offload;
> + }
Looks like 0 is the only problematic value for the code, so
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
thanks
-- PMM
next prev parent reply other threads:[~2023-04-13 18:25 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-13 17:19 [PATCH] rtl8139: fix large_send_mss divide-by-zero Stefan Hajnoczi
2023-04-13 18:24 ` Peter Maydell [this message]
2023-04-14 3:13 ` Jason Wang
2023-04-14 9:17 ` Michael Tokarev
2023-04-14 10:10 ` Alexander Bulekov
2023-04-14 13:54 ` Philippe Mathieu-Daudé
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='CAFEAcA8J4zWVL=dBAY1KYxU_im392xU1rU=GN=yQKhG6Og=SAQ@mail.gmail.com' \
--to=peter.maydell@linaro.org \
--cc=alxndr@bu.edu \
--cc=jasowang@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
/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).