From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53423) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZMEY7-0002ag-1E for qemu-devel@nongnu.org; Mon, 03 Aug 2015 08:09:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZMEY3-0008Sk-4U for qemu-devel@nongnu.org; Mon, 03 Aug 2015 08:08:58 -0400 From: Stefan Hajnoczi Date: Mon, 3 Aug 2015 13:08:40 +0100 Message-Id: <1438603721-28320-7-git-send-email-stefanha@redhat.com> In-Reply-To: <1438603721-28320-1-git-send-email-stefanha@redhat.com> References: <1438603721-28320-1-git-send-email-stefanha@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PULL for-2.4 6/7] rtl8139: skip offload on short TCP header (CVE-2015-5165) List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Peter Maydell , Jason Wang , qemu-stable@nongnu.org, Stefan Hajnoczi TCP Large Segment Offload accesses the TCP header in the packet. If the packet is too short we must not attempt to access header fields: tcp_header *p_tcp_hdr =3D (tcp_header*)(eth_payload_data + hlen); int tcp_hlen =3D TCP_HEADER_DATA_OFFSET(p_tcp_hdr); Reported-by: =E6=9C=B1=E4=B8=9C=E6=B5=B7(=E5=90=AF=E8=B7=AF) Reviewed-by: Jason Wang Signed-off-by: Stefan Hajnoczi --- hw/net/rtl8139.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/hw/net/rtl8139.c b/hw/net/rtl8139.c index 6859d76..fa01934 100644 --- a/hw/net/rtl8139.c +++ b/hw/net/rtl8139.c @@ -2210,6 +2210,11 @@ static int rtl8139_cplus_transmit_one(RTL8139State= *s) =20 if ((txdw0 & CP_TX_LGSEN) && ip_protocol =3D=3D IP_PROTO_TCP= ) { + /* Large enough for the TCP header? */ + if (ip_data_len < sizeof(tcp_header)) { + goto skip_offload; + } + int large_send_mss =3D (txdw0 >> 16) & CP_TC_LGSEN_MSS_M= ASK; =20 DPRINTF("+++ C+ mode offloaded task TSO MTU=3D%d IP data= %d " --=20 2.4.3