From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id E904145EB6; Tue, 17 Dec 2024 16:33:06 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 77D21406B6; Tue, 17 Dec 2024 16:33:06 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mails.dpdk.org (Postfix) with ESMTP id 546AE402B1 for ; Tue, 17 Dec 2024 16:33:05 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1734449584; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=mO+Kx8Rk2+7nbPbRS77lx0IQHuEVX7eONcNTjaro2vE=; b=T5kcvgiwrcCGbi1eX6oVgoUWer2brkg2I5695SAOYwOSTUiNYjsli8O1aMQtgDW01wAtyU rAyvQTnxVLbYQP0vfNMm5q9fFZA87xmacWxjcpkRmaf7LnqO4XAyVdTgTlQ5C9g5kZkHOl QFUPqsL4cEkSYIUwNX1PYglLNbaD3O8= Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-567-jIxdRxLLOb6hBuzUvf5j9g-1; Tue, 17 Dec 2024 10:33:03 -0500 X-MC-Unique: jIxdRxLLOb6hBuzUvf5j9g-1 X-Mimecast-MFC-AGG-ID: jIxdRxLLOb6hBuzUvf5j9g Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 7BE4E1955F2C; Tue, 17 Dec 2024 15:33:02 +0000 (UTC) Received: from max-p1.redhat.com (unknown [10.39.208.39]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id A985E1956053; Tue, 17 Dec 2024 15:33:00 +0000 (UTC) From: Maxime Coquelin To: dev@dpdk.org Cc: Olivier Matz , Maxime Gouin , Maxime Coquelin Subject: [PATCH] net/virtio: fix Rx checksum calculation Date: Tue, 17 Dec 2024 16:32:53 +0100 Message-ID: <20241217153253.457646-1-maxime.coquelin@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: y1ZNHRNAWr6iwbVsQjYvXpAbp2W_VjfpKTR8b13OJnQ_1734449582 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit content-type: text/plain; charset="US-ASCII"; x-default=true X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Olivier Matz If hdr->csum_start is larger than packet length, the len argument passed to rte_raw_cksum_mbuf() overflows and causes a segmentation fault. Ignore checksum computation in this case. CVE-2024-11614 Fixes: ca7036b4af3a ("vhost: fix offload flags in Rx path") Signed-off-by: Maxime Gouin Signed-off-by: Olivier Matz Reviewed-by: Maxime Coquelin --- lib/vhost/virtio_net.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/vhost/virtio_net.c b/lib/vhost/virtio_net.c index d764d4bc6a..69901ab3b5 100644 --- a/lib/vhost/virtio_net.c +++ b/lib/vhost/virtio_net.c @@ -2823,6 +2823,9 @@ vhost_dequeue_offload(struct virtio_net *dev, struct virtio_net_hdr *hdr, */ uint16_t csum = 0, off; + if (hdr->csum_start >= rte_pktmbuf_pkt_len(m)) + return; + if (rte_raw_cksum_mbuf(m, hdr->csum_start, rte_pktmbuf_pkt_len(m) - hdr->csum_start, &csum) < 0) return; -- 2.47.0