qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] e1000: Fix TCP checksum overflow with TSO
@ 2010-11-05 20:52 Alex Williamson
  2010-11-08 10:51 ` [Qemu-devel] " Michael S. Tsirkin
  0 siblings, 1 reply; 2+ messages in thread
From: Alex Williamson @ 2010-11-05 20:52 UTC (permalink / raw)
  To: qemu-devel; +Cc: alex.williamson, dwu, mst

When adding the length to the pseudo header, we're not properly
accounting for overflow.

From: Mark Wu <dwu@redhat.com>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
---

 hw/e1000.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/hw/e1000.c b/hw/e1000.c
index 532efdc..677165f 100644
--- a/hw/e1000.c
+++ b/hw/e1000.c
@@ -384,9 +384,12 @@ xmit_seg(E1000State *s)
         } else	// UDP
             cpu_to_be16wu((uint16_t *)(tp->data+css+4), len);
         if (tp->sum_needed & E1000_TXD_POPTS_TXSM) {
+            unsigned int phsum;
             // add pseudo-header length before checksum calculation
             sp = (uint16_t *)(tp->data + tp->tucso);
-            cpu_to_be16wu(sp, be16_to_cpup(sp) + len);
+            phsum = be16_to_cpup(sp) + len;
+            phsum = (phsum >> 16) + (phsum & 0xffff);
+            cpu_to_be16wu(sp, phsum);
         }
         tp->tso_frames++;
     }

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [Qemu-devel] Re: [PATCH] e1000: Fix TCP checksum overflow with TSO
  2010-11-05 20:52 [Qemu-devel] [PATCH] e1000: Fix TCP checksum overflow with TSO Alex Williamson
@ 2010-11-08 10:51 ` Michael S. Tsirkin
  0 siblings, 0 replies; 2+ messages in thread
From: Michael S. Tsirkin @ 2010-11-08 10:51 UTC (permalink / raw)
  To: Alex Williamson; +Cc: dwu, qemu-devel

On Fri, Nov 05, 2010 at 02:52:08PM -0600, Alex Williamson wrote:
> When adding the length to the pseudo header, we're not properly
> accounting for overflow.
> 
> From: Mark Wu <dwu@redhat.com>
> Signed-off-by: Alex Williamson <alex.williamson@redhat.com>

Thanks, applied.

> ---
> 
>  hw/e1000.c |    5 ++++-
>  1 files changed, 4 insertions(+), 1 deletions(-)
> 
> diff --git a/hw/e1000.c b/hw/e1000.c
> index 532efdc..677165f 100644
> --- a/hw/e1000.c
> +++ b/hw/e1000.c
> @@ -384,9 +384,12 @@ xmit_seg(E1000State *s)
>          } else	// UDP
>              cpu_to_be16wu((uint16_t *)(tp->data+css+4), len);
>          if (tp->sum_needed & E1000_TXD_POPTS_TXSM) {
> +            unsigned int phsum;
>              // add pseudo-header length before checksum calculation
>              sp = (uint16_t *)(tp->data + tp->tucso);
> -            cpu_to_be16wu(sp, be16_to_cpup(sp) + len);
> +            phsum = be16_to_cpup(sp) + len;
> +            phsum = (phsum >> 16) + (phsum & 0xffff);
> +            cpu_to_be16wu(sp, phsum);
>          }
>          tp->tso_frames++;
>      }

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-11-08 10:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-05 20:52 [Qemu-devel] [PATCH] e1000: Fix TCP checksum overflow with TSO Alex Williamson
2010-11-08 10:51 ` [Qemu-devel] " Michael S. Tsirkin

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).