Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0D7C013C689 for ; Fri, 21 Jun 2024 10:24:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718965450; cv=none; b=Aqv870Ys6Q9C/bL/Q8f78M64AKXb8/mhg5W5eiiJLr34M7GJI/hsLvRgfG+OiCqvsJRgyIRKJaDnAifsRmi2SPZ3MvwSCzkPjGPo0/rI3JVR9zN6ZfKLyUHU0Op9TyYg3hvpNP5SIBDJlbYzrC+BesObAYfe7yd09mfIczQ4R0c= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718965450; c=relaxed/simple; bh=VrUi33m3H24GDlKSXKJov6tnMr1IKBIOgXy+/Osjkmg=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=MCWg+t4mWU2za1DfsU1jc8cVHGj895y3jHTZCSnkoaKPpYvLxMD85ZMgTi+N4nUCdiUZ4jQ64EClhrOieb8ZhQbAFEi5VBfJd61CKXjPhW1oZV8wfAxLc/94ozHdY3Bksw6Ze2b7fQHiLrZTpT/rT+B0cGArPAP978vXZuXZmM8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=s0Fgdl7+; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="s0Fgdl7+" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 850DFC2BBFC; Fri, 21 Jun 2024 10:24:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1718965449; bh=VrUi33m3H24GDlKSXKJov6tnMr1IKBIOgXy+/Osjkmg=; h=From:To:Cc:Subject:Date:Reply-to:From; b=s0Fgdl7+QdMqQqAfsoqeFdg4eF1479VUNvqpg/gLuDMPXRORghyx/ggrSNArwtkpj sgyeOMbawj7nTQNctD943I/ksiLuRssdkwEpEPBi4SUOaiJIopckGBxnXyjBCvajem ELDwgCvrV+39JE7JkT/34yOm/eN0ItEEwGIF8Bwo= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2024-37353: virtio: delete vq in vp_find_vqs_msix() when request_irq() fails Date: Fri, 21 Jun 2024 12:19:41 +0200 Message-ID: <2024062137-CVE-2024-37353-71d4@gregkh> X-Mailer: git-send-email 2.45.2 Precedence: bulk X-Mailing-List: linux-cve-announce@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Reply-to: , X-Developer-Signature: v=1; a=openpgp-sha256; l=5727; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=VrUi33m3H24GDlKSXKJov6tnMr1IKBIOgXy+/Osjkmg=; b=owGbwMvMwCRo6H6F97bub03G02pJDGmlwTsfWi2xCdc4te5NjpxYr/b+0HTlNy0Jy9My1qX9P D793k3xjlgWBkEmBlkxRZYv23iO7q84pOhlaHsaZg4rE8gQBi5OAZjIM3GGOVzNPae8r7McC37z IGbBjvolU+QdahjmJ/KJ/NV76Xuxp+msiXn+iv9HjyxqBAA= X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 Content-Transfer-Encoding: 8bit Description =========== In the Linux kernel, the following vulnerability has been resolved: virtio: delete vq in vp_find_vqs_msix() when request_irq() fails When request_irq() fails, error path calls vp_del_vqs(). There, as vq is present in the list, free_irq() is called for the same vector. That causes following splat: [ 0.414355] Trying to free already-free IRQ 27 [ 0.414403] WARNING: CPU: 1 PID: 1 at kernel/irq/manage.c:1899 free_irq+0x1a1/0x2d0 [ 0.414510] Modules linked in: [ 0.414540] CPU: 1 PID: 1 Comm: swapper/0 Not tainted 6.9.0-rc4+ #27 [ 0.414540] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.3-1.fc39 04/01/2014 [ 0.414540] RIP: 0010:free_irq+0x1a1/0x2d0 [ 0.414540] Code: 1e 00 48 83 c4 08 48 89 e8 5b 5d 41 5c 41 5d 41 5e 41 5f c3 cc cc cc cc 90 8b 74 24 04 48 c7 c7 98 80 6c b1 e8 00 c9 f7 ff 90 <0f> 0b 90 90 48 89 ee 4c 89 ef e8 e0 20 b8 00 49 8b 47 40 48 8b 40 [ 0.414540] RSP: 0000:ffffb71480013ae0 EFLAGS: 00010086 [ 0.414540] RAX: 0000000000000000 RBX: ffffa099c2722000 RCX: 0000000000000000 [ 0.414540] RDX: 0000000000000000 RSI: ffffb71480013998 RDI: 0000000000000001 [ 0.414540] RBP: 0000000000000246 R08: 00000000ffffdfff R09: 0000000000000001 [ 0.414540] R10: 00000000ffffdfff R11: ffffffffb18729c0 R12: ffffa099c1c91760 [ 0.414540] R13: ffffa099c1c916a4 R14: ffffa099c1d2f200 R15: ffffa099c1c91600 [ 0.414540] FS: 0000000000000000(0000) GS:ffffa099fec40000(0000) knlGS:0000000000000000 [ 0.414540] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 0.414540] CR2: 0000000000000000 CR3: 0000000008e3e001 CR4: 0000000000370ef0 [ 0.414540] Call Trace: [ 0.414540] [ 0.414540] ? __warn+0x80/0x120 [ 0.414540] ? free_irq+0x1a1/0x2d0 [ 0.414540] ? report_bug+0x164/0x190 [ 0.414540] ? handle_bug+0x3b/0x70 [ 0.414540] ? exc_invalid_op+0x17/0x70 [ 0.414540] ? asm_exc_invalid_op+0x1a/0x20 [ 0.414540] ? free_irq+0x1a1/0x2d0 [ 0.414540] vp_del_vqs+0xc1/0x220 [ 0.414540] vp_find_vqs_msix+0x305/0x470 [ 0.414540] vp_find_vqs+0x3e/0x1a0 [ 0.414540] vp_modern_find_vqs+0x1b/0x70 [ 0.414540] init_vqs+0x387/0x600 [ 0.414540] virtnet_probe+0x50a/0xc80 [ 0.414540] virtio_dev_probe+0x1e0/0x2b0 [ 0.414540] really_probe+0xc0/0x2c0 [ 0.414540] ? __pfx___driver_attach+0x10/0x10 [ 0.414540] __driver_probe_device+0x73/0x120 [ 0.414540] driver_probe_device+0x1f/0xe0 [ 0.414540] __driver_attach+0x88/0x180 [ 0.414540] bus_for_each_dev+0x85/0xd0 [ 0.414540] bus_add_driver+0xec/0x1f0 [ 0.414540] driver_register+0x59/0x100 [ 0.414540] ? __pfx_virtio_net_driver_init+0x10/0x10 [ 0.414540] virtio_net_driver_init+0x90/0xb0 [ 0.414540] do_one_initcall+0x58/0x230 [ 0.414540] kernel_init_freeable+0x1a3/0x2d0 [ 0.414540] ? __pfx_kernel_init+0x10/0x10 [ 0.414540] kernel_init+0x1a/0x1c0 [ 0.414540] ret_from_fork+0x31/0x50 [ 0.414540] ? __pfx_kernel_init+0x10/0x10 [ 0.414540] ret_from_fork_asm+0x1a/0x30 [ 0.414540] Fix this by calling deleting the current vq when request_irq() fails. The Linux kernel CVE team has assigned CVE-2024-37353 to this issue. Affected and fixed versions =========================== Issue introduced in 4.11 with commit 0b0f9dc52ed0 and fixed in 4.19.316 with commit cb7a7c8144b4 Issue introduced in 4.11 with commit 0b0f9dc52ed0 and fixed in 5.4.278 with commit 43a9aaf63254 Issue introduced in 4.11 with commit 0b0f9dc52ed0 and fixed in 5.10.219 with commit 7fbe54f02a5c Issue introduced in 4.11 with commit 0b0f9dc52ed0 and fixed in 5.15.161 with commit 42d30da50d5c Issue introduced in 4.11 with commit 0b0f9dc52ed0 and fixed in 6.1.93 with commit abf001651acd Issue introduced in 4.11 with commit 0b0f9dc52ed0 and fixed in 6.6.33 with commit 04207a9c64e0 Issue introduced in 4.11 with commit 0b0f9dc52ed0 and fixed in 6.9.4 with commit bb61a8479385 Issue introduced in 4.11 with commit 0b0f9dc52ed0 and fixed in 6.10-rc1 with commit 89875151fccd Please see https://www.kernel.org for a full list of currently supported kernel versions by the kernel community. Unaffected versions might change over time as fixes are backported to older supported kernel versions. The official CVE entry at https://cve.org/CVERecord/?id=CVE-2024-37353 will be updated if fixes are backported, please check that for the most up to date information about this issue. Affected files ============== The file(s) affected by this issue are: drivers/virtio/virtio_pci_common.c Mitigation ========== The Linux kernel CVE team recommends that you update to the latest stable kernel version for this, and many other bugfixes. Individual changes are never tested alone, but rather are part of a larger kernel release. Cherry-picking individual commits is not recommended or supported by the Linux kernel community at all. If however, updating to the latest release is impossible, the individual changes to resolve this issue can be found at these commits: https://git.kernel.org/stable/c/cb7a7c8144b434e06aba99b13b045a7efe859587 https://git.kernel.org/stable/c/43a9aaf63254ab821f0f25fea25698ebe69ea16a https://git.kernel.org/stable/c/7fbe54f02a5c77ff5dd65e8ed0b58e3bd8c43e9c https://git.kernel.org/stable/c/42d30da50d5c1ec433fd9551bfddd6887407c352 https://git.kernel.org/stable/c/abf001651acd1858252764fa39d79e3d0b5c86b2 https://git.kernel.org/stable/c/04207a9c64e0b16dac842e5b2ecfa53af25bdea7 https://git.kernel.org/stable/c/bb61a84793858330ba2ca1d202d3779096f6fb54 https://git.kernel.org/stable/c/89875151fccdd024d571aa884ea97a0128b968b6