提交 1f892feb 编写于 作者: A Alex Williamson 提交者: Anthony Liguori

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 <dwu@redhat.com>
Signed-off-by: NAlex Williamson <alex.williamson@redhat.com>
Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
上级 27a6375d
...@@ -384,9 +384,12 @@ xmit_seg(E1000State *s) ...@@ -384,9 +384,12 @@ xmit_seg(E1000State *s)
} else // UDP } else // UDP
cpu_to_be16wu((uint16_t *)(tp->data+css+4), len); cpu_to_be16wu((uint16_t *)(tp->data+css+4), len);
if (tp->sum_needed & E1000_TXD_POPTS_TXSM) { if (tp->sum_needed & E1000_TXD_POPTS_TXSM) {
unsigned int phsum;
// add pseudo-header length before checksum calculation // add pseudo-header length before checksum calculation
sp = (uint16_t *)(tp->data + tp->tucso); 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++; tp->tso_frames++;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册