From: Alex Williamson Date: Fri, 5 Nov 2010 20:52:08 +0000 (-0600) Subject: e1000: Fix TCP checksum overflow with TSO X-Git-Tag: Tizen_Studio_1.3_Release_p2.3.1~1405^2~17^2~3281^2~28 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e685b4eb649cbddd26f203b611eabeb714648f4d;p=sdk%2Femulator%2Fqemu.git e1000: Fix TCP checksum overflow with TSO When adding the length to the pseudo header, we're not properly accounting for overflow. From: Mark Wu Signed-off-by: Alex Williamson Signed-off-by: Michael S. Tsirkin --- diff --git a/hw/e1000.c b/hw/e1000.c index 532efdc27d..677165f830 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++; }