From mboxrd@z Thu Jan 1 00:00:00 1970 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 DC84526293 for ; Mon, 4 Mar 2024 18:07:32 +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=1709575652; cv=none; b=XVw+BClKeFYakEQ1Oy/MyjlZqHwuNUgd8b5tJ6Ez3kSx0Dr0Qp7NFi+xFkk221sfEku0RAVPUedIYeoYXVF1izNAHwGgMtrVQJg8VesBvsInsK+7t/8GfzqGjeyyT+m4EPawRwwBqgeg5Reg6czkJydeefGR8RfrggmrEYmPXZI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709575652; c=relaxed/simple; bh=MF6kPU3YceC847zV6g5AZ4LtubDjti2XC6wt5E9PquA=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=bgFSTt2A9os2qy4aH3536WY9iH/LHMIbqbtu3kFcxrqiI4ps5EolMB1zXA6gr2Z09dwvZ/wsFUDfnBrwA5hO0j4bDudKg/BpQw9LaKcJmjONql/I2dVBYzSFg8N9FUtlYgUgwFuqtL99wtDvLpBtbMdXoSmQS/hyZdGBU20MS24= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=fsxvIuXp; 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="fsxvIuXp" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E1F00C433C7; Mon, 4 Mar 2024 18:07:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1709575652; bh=MF6kPU3YceC847zV6g5AZ4LtubDjti2XC6wt5E9PquA=; h=From:To:Cc:Subject:Date:Reply-to:From; b=fsxvIuXpXUaBlKx7dMhvoV3GYHo/npiZAlW3XFz7DrCCqP084Zju3DnyRaXFZtVBD i2uFr3ydaHUm9zSLPeIR8zJib6U6Lz3BT+ppT/VHVTHxYFHIcA+amLXJdrKQKSD5cX 4eb3AaExgSG39aaE84YXiss8sOKDjAaK7Lcy/Q48= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2021-47084: hamradio: defer ax25 kfree after unregister_netdev Date: Mon, 4 Mar 2024 19:06:54 +0100 Message-ID: <2024030455-CVE-2021-47084-4984@gregkh> X-Mailer: git-send-email 2.44.0 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=3382; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=MF6kPU3YceC847zV6g5AZ4LtubDjti2XC6wt5E9PquA=; b=owGbwMvMwCRo6H6F97bub03G02pJDKnPePc/0mhV3Rkbn+f458stjo93r3upW6n8PJBS8Stj3 mGOsr2tHbEsDIJMDLJiiixftvEc3V9xSNHL0PY0zBxWJpAhDFycAjCRtnsM8zRfvJqxxK2H5SwD x+LjcZae35ZNW8gwz9JLZX72dQGdS9FyhhXXVHx7N89aCwA= 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: hamradio: defer ax25 kfree after unregister_netdev There is a possible race condition (use-after-free) like below (USE) | (FREE) ax25_sendmsg | ax25_queue_xmit | dev_queue_xmit | __dev_queue_xmit | __dev_xmit_skb | sch_direct_xmit | ... xmit_one | netdev_start_xmit | tty_ldisc_kill __netdev_start_xmit | mkiss_close ax_xmit | kfree ax_encaps | | Even though there are two synchronization primitives before the kfree: 1. wait_for_completion(&ax->dead). This can prevent the race with routines from mkiss_ioctl. However, it cannot stop the routine coming from upper layer, i.e., the ax25_sendmsg. 2. netif_stop_queue(ax->dev). It seems that this line of code aims to halt the transmit queue but it fails to stop the routine that already being xmit. This patch reorder the kfree after the unregister_netdev to avoid the possible UAF as the unregister_netdev() is well synchronized and won't return if there is a running routine. The Linux kernel CVE team has assigned CVE-2021-47084 to this issue. Affected and fixed versions =========================== Fixed in 4.4.297 with commit b5b193d0c671 Fixed in 4.9.295 with commit 8a1a314965a1 Fixed in 4.14.260 with commit eaa816a86e62 Fixed in 4.19.223 with commit 896193a02a29 Fixed in 5.4.169 with commit ef5f7bfa19e3 Fixed in 5.10.89 with commit 450121075a6a Fixed in 5.15.12 with commit cb6c99aedd2c Fixed in 5.16 with commit 3e0588c291d6 Please see https://www.kernel.org or 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-2021-47084 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/hamradio/mkiss.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/b5b193d0c67180fefdc664650138e3b7959df615 https://git.kernel.org/stable/c/8a1a314965a17c62084a056b4f2cb7a770854c90 https://git.kernel.org/stable/c/eaa816a86e629cbcc0a94f38391fee09231628c7 https://git.kernel.org/stable/c/896193a02a2981e60c40d4614fd095ce92135ccd https://git.kernel.org/stable/c/ef5f7bfa19e3fc366f4c6d1a841ceaddf7a9f5d4 https://git.kernel.org/stable/c/450121075a6a6f1d50f97225d3396315309d61a1 https://git.kernel.org/stable/c/cb6c99aedd2c843056a598a8907a6128cb07603b https://git.kernel.org/stable/c/3e0588c291d6ce225f2b891753ca41d45ba42469