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 E10AD45EB6 for ; Tue, 17 Dec 2024 16:35:34 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B2F8F402B1; Tue, 17 Dec 2024 16:35:34 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id D7C54402B1 for ; Tue, 17 Dec 2024 16:35:32 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1734449732; 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=2if5t4ER5CDF29Ozl1gfUEgczHJA5Ik1YDhWqcJ/6hk=; b=O8JVAwJzPDIuBR/m4F3HnjRKOmURA+VqU+lGGQPEU/zbGB7uoOId7l6Px58ilQKE6ZrMDI pQcsSIyWp0+SCTIFxZI19+HVHWrBtsal1fZMflqEcXgrMa/9LrzBs/7bV6EcNMnFjG6hTG 89Dv6iu02+lFxAHjWPrTg2qGCLOkmyc= Received: from mx-prod-mc-01.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-144-FZtqsD5POxqoel3nSpImZA-1; Tue, 17 Dec 2024 10:35:26 -0500 X-MC-Unique: FZtqsD5POxqoel3nSpImZA-1 X-Mimecast-MFC-AGG-ID: FZtqsD5POxqoel3nSpImZA Received: from mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.15]) (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-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 9C6BD195608C; Tue, 17 Dec 2024 15:35:24 +0000 (UTC) Received: from max-p1.redhat.com (unknown [10.39.208.39]) by mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id D69B019560A2; Tue, 17 Dec 2024 15:35:22 +0000 (UTC) From: Maxime Coquelin To: stable@dpdk.org Cc: Olivier Matz , Maxime Gouin , Maxime Coquelin Subject: [PATCH 21.11] net/virtio: fix Rx checksum calculation Date: Tue, 17 Dec 2024 16:35:20 +0100 Message-ID: <20241217153520.459704-1-maxime.coquelin@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.15 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: vQbaAG07i7CR-ibU0vOrEkalj9oh_IcGMrrr89nXUGA_1734449724 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit content-type: text/plain; charset="US-ASCII"; x-default=true X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-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 9f74a3c997..5f446eaabf 100644 --- a/lib/vhost/virtio_net.c +++ b/lib/vhost/virtio_net.c @@ -2261,6 +2261,9 @@ vhost_dequeue_offload(struct virtio_net_hdr *hdr, struct rte_mbuf *m, */ 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