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 AA0ED19923E for ; Tue, 16 Jul 2024 12:29:07 +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=1721132947; cv=none; b=kOu0Zq/rpmZp5pyfkAnFFBhNbsZBROfp6IHbUF8sSNQAoP7h1xV9/vcEAJeZbkSWlZeCH8sLV+8/ArhyVszSI9VSsTgEwUKBEmQEvk9JAzqaZD7KyGlYo0LIXjLZL7DozVae+nrPg8lOH7Ovdnn1ws7w18A6ii6mrpzgwGoEfYQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721132947; c=relaxed/simple; bh=POs8hC5jGyYa4weffFtUwQ0arl8AFTTXqpaDzfaxw0U=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=bpPhWWcDrjNMlVM5PaTYmEFT1k9J+MmeemHhVdD3pwO9BtwR3ROppBz+Dm5pNPkt31U6ln7ozWXK9xAORlt3LYkrYK9e2LoTqaj6pjeKZMhgUZRqS+vYgvnfy5wEFnXsFA9dyVgWKTyKRUh534d3pQAvz6i3EXbh0+aDED+zrUw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=JxzTjhZ4; 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="JxzTjhZ4" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D2A3AC116B1; Tue, 16 Jul 2024 12:29:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1721132947; bh=POs8hC5jGyYa4weffFtUwQ0arl8AFTTXqpaDzfaxw0U=; h=From:To:Cc:Subject:Date:Reply-to:From; b=JxzTjhZ4QFr6KyK7FS4kyEMz9QSnJwC5dJK7j0lhiS0f0BvjlYMhhz9QOF0KF7z1Q rJ7bg+cFoanQGAwGvi/bzWXKeQPTb7zBJi/AGkTMfcLi/nKCM9CNNspVkZ9Q+m7N5G e60yXwupeG7nvyEBd69XhsfOxQ97D43F4HTdfsx4= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2022-48840: iavf: Fix hang during reboot/shutdown Date: Tue, 16 Jul 2024 14:27:25 +0200 Message-ID: <2024071622-CVE-2022-48840-d1d6@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=3899; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=POs8hC5jGyYa4weffFtUwQ0arl8AFTTXqpaDzfaxw0U=; b=owGbwMvMwCRo6H6F97bub03G02pJDGnT0rUcGfOe3T3x2/5FN2N28JrSWf/W88YsTjNNr9asf b76iPWzjlgWBkEmBlkxRZYv23iO7q84pOhlaHsaZg4rE8gQBi5OAZiIqQ3Dgkndp+3zFY5r5plO 2feZe5ayusY1B4YFK660ct5iEzrvedqnqrL1h//uL9YPAA== 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: iavf: Fix hang during reboot/shutdown Recent commit 974578017fc1 ("iavf: Add waiting so the port is initialized in remove") adds a wait-loop at the beginning of iavf_remove() to ensure that port initialization is finished prior unregistering net device. This causes a regression in reboot/shutdown scenario because in this case callback iavf_shutdown() is called and this callback detaches the device, makes it down if it is running and sets its state to __IAVF_REMOVE. Later shutdown callback of associated PF driver (e.g. ice_shutdown) is called. That callback calls among other things sriov_disable() that calls indirectly iavf_remove() (see stack trace below). As the adapter state is already __IAVF_REMOVE then the mentioned loop is end-less and shutdown process hangs. The patch fixes this by checking adapter's state at the beginning of iavf_remove() and skips the rest of the function if the adapter is already in remove state (shutdown is in progress). Reproducer: 1. Create VF on PF driven by ice or i40e driver 2. Ensure that the VF is bound to iavf driver 3. Reboot [52625.981294] sysrq: SysRq : Show Blocked State [52625.988377] task:reboot state:D stack: 0 pid:17359 ppid: 1 f2 [52625.996732] Call Trace: [52625.999187] __schedule+0x2d1/0x830 [52626.007400] schedule+0x35/0xa0 [52626.010545] schedule_hrtimeout_range_clock+0x83/0x100 [52626.020046] usleep_range+0x5b/0x80 [52626.023540] iavf_remove+0x63/0x5b0 [iavf] [52626.027645] pci_device_remove+0x3b/0xc0 [52626.031572] device_release_driver_internal+0x103/0x1f0 [52626.036805] pci_stop_bus_device+0x72/0xa0 [52626.040904] pci_stop_and_remove_bus_device+0xe/0x20 [52626.045870] pci_iov_remove_virtfn+0xba/0x120 [52626.050232] sriov_disable+0x2f/0xe0 [52626.053813] ice_free_vfs+0x7c/0x340 [ice] [52626.057946] ice_remove+0x220/0x240 [ice] [52626.061967] ice_shutdown+0x16/0x50 [ice] [52626.065987] pci_device_shutdown+0x34/0x60 [52626.070086] device_shutdown+0x165/0x1c5 [52626.074011] kernel_restart+0xe/0x30 [52626.077593] __do_sys_reboot+0x1d2/0x210 [52626.093815] do_syscall_64+0x5b/0x1a0 [52626.097483] entry_SYSCALL_64_after_hwframe+0x65/0xca The Linux kernel CVE team has assigned CVE-2022-48840 to this issue. Affected and fixed versions =========================== Issue introduced in 5.15.27 with commit 85aa76066fef and fixed in 5.15.31 with commit 80974bb73027 Issue introduced in 5.16.13 with commit 7b9515172ab4 and fixed in 5.16.17 with commit 4477b9a4193b 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-2022-48840 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/net/ethernet/intel/iavf/iavf_main.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/80974bb730270199c6fcb189af04d5945b87e813 https://git.kernel.org/stable/c/4477b9a4193b35eb3a8afd2adf2d42add2f88d57 https://git.kernel.org/stable/c/b04683ff8f0823b869c219c78ba0d974bddea0b5