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 CEEEC1114 for ; Wed, 21 Aug 2024 06:12:06 +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=1724220726; cv=none; b=UYK5RIgq84RQ276gb0uGVf1XzHzbkd7+cZ0rgVB8s4lyYsSDDUhL/o45Qrs+hSHsIvUtkT1QiYW0cVF2YFNyNe/sVXGC15xFEZWuQNxtDgyocTSdbwk8f1PeA9ai0Zzyv/K/l2T9liE0KwtWmQ9NK0LJbSbb8uNquwCwHxzeYv8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724220726; c=relaxed/simple; bh=IYAHDFwqcFomr/ZZxsSjt35v3fEPQcYQrXvbH7znWS0=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=T7C/IQWWxQ9hqU63T71UcNKuwgP+NdqwFnuTupvns+0snxZiboNRtUcnWIgRgjG/9KUCtoduC8qBxxPF3gwoHPdVYzt5aRwcxKEA5fNdqXVcf84yrx/21F5r8ofZclPT1DPiStp0XiaXx7UoUXOUXPUYXmdCL5oW0NP/OA6Mjec= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=ocEGp42b; 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="ocEGp42b" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5BFD4C32782; Wed, 21 Aug 2024 06:12:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1724220726; bh=IYAHDFwqcFomr/ZZxsSjt35v3fEPQcYQrXvbH7znWS0=; h=From:To:Cc:Subject:Date:Reply-to:From; b=ocEGp42bhm8iEMzZNIsjL9RsGlDstub2JgQtyr+yyvEaSXjaza7XWERlTw5pASqUp DHktVIs5etLnOasrhE4GnrQ3zl0liD9S73udlA4t3ydufTcrwns4HkfrBQWugu3Ai+ TO48ep86hMzFbEJk7wzYW8tbzoBTQ1XWRZUbki/s= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2022-48884: net/mlx5: Fix command stats access after free Date: Wed, 21 Aug 2024 14:11:18 +0800 Message-ID: <2024082108-CVE-2022-48884-b273@gregkh> X-Mailer: git-send-email 2.46.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=3191; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=IYAHDFwqcFomr/ZZxsSjt35v3fEPQcYQrXvbH7znWS0=; b=owGbwMvMwCRo6H6F97bub03G02pJDGlHW/4YBQhd/RBg8upeB7tGTJu9Pp+KqtOOa2sPnXySH Pyj+Gt1RywLgyATg6yYIsuXbTxH91ccUvQytD0NM4eVCWQIAxenAExEmp1hfjVD/rdLQW7OC5ja DDZeCH+mtuHjRob5Pl6SATMvxry8+3eLstyBfDfT9+wCAA== 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: net/mlx5: Fix command stats access after free Command may fail while driver is reloading and can't accept FW commands till command interface is reinitialized. Such command failure is being logged to command stats. This results in NULL pointer access as command stats structure is being freed and reallocated during mlx5 devlink reload (see kernel log below). Fix it by making command stats statically allocated on driver probe. Kernel log: [ 2394.808802] BUG: unable to handle kernel paging request at 000000000002a9c0 [ 2394.810610] PGD 0 P4D 0 [ 2394.811811] Oops: 0002 [#1] SMP NOPTI ... [ 2394.815482] RIP: 0010:native_queued_spin_lock_slowpath+0x183/0x1d0 ... [ 2394.829505] Call Trace: [ 2394.830667] _raw_spin_lock_irq+0x23/0x26 [ 2394.831858] cmd_status_err+0x55/0x110 [mlx5_core] [ 2394.833020] mlx5_access_reg+0xe7/0x150 [mlx5_core] [ 2394.834175] mlx5_query_port_ptys+0x78/0xa0 [mlx5_core] [ 2394.835337] mlx5e_ethtool_get_link_ksettings+0x74/0x590 [mlx5_core] [ 2394.836454] ? kmem_cache_alloc_trace+0x140/0x1c0 [ 2394.837562] __rh_call_get_link_ksettings+0x33/0x100 [ 2394.838663] ? __rtnl_unlock+0x25/0x50 [ 2394.839755] __ethtool_get_link_ksettings+0x72/0x150 [ 2394.840862] duplex_show+0x6e/0xc0 [ 2394.841963] dev_attr_show+0x1c/0x40 [ 2394.843048] sysfs_kf_seq_show+0x9b/0x100 [ 2394.844123] seq_read+0x153/0x410 [ 2394.845187] vfs_read+0x91/0x140 [ 2394.846226] ksys_read+0x4f/0xb0 [ 2394.847234] do_syscall_64+0x5b/0x1a0 [ 2394.848228] entry_SYSCALL_64_after_hwframe+0x65/0xca The Linux kernel CVE team has assigned CVE-2022-48884 to this issue. Affected and fixed versions =========================== Issue introduced in 5.18 with commit 34f46ae0d4b3 and fixed in 6.1.7 with commit ddf458641a51 Issue introduced in 5.18 with commit 34f46ae0d4b3 and fixed in 6.2 with commit da2e552b469a 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-48884 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/mellanox/mlx5/core/cmd.c include/linux/mlx5/driver.h 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/ddf458641a511e7dff19f3bf0cbbc5dd9fe08ce5 https://git.kernel.org/stable/c/da2e552b469a0cd130ff70a88ccc4139da428a65