]> git.proxmox.com Git - qemu.git/commitdiff
e1000: Fix TCP checksum overflow with TSO
authorAlex Williamson <alex.williamson@redhat.com>
Fri, 5 Nov 2010 20:52:08 +0000 (14:52 -0600)
committerAnthony Liguori <aliguori@us.ibm.com>
Tue, 16 Nov 2010 14:40:08 +0000 (08:40 -0600)
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>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
hw/e1000.c

index 532efdc27dff1d937386ec32b045796ff293763f..677165f830963b4a84fa601ab1aef5d7dcff0865 100644 (file)
@@ -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++;
     }