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 89EE62E5B09 for ; Tue, 7 Oct 2025 15:26:17 +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=1759850777; cv=none; b=uqNZd/Qx8iMoeqnpascb5H0CCiLIAPERqh3RVPano+Wk7k3IfQXDh2QTKb7pvvkURog295oIXhXOe6/0Mi3gjaW0EknBPQNuIad4Hv/Jp/RzjG2CO5wFCfrixl3kUSqa4FECWxbDrUzQGG71Xa3FQWdz0bZ96/EEFuMT0iNdtbE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759850777; c=relaxed/simple; bh=1egNc0S3stbS1qtX8GeMEiDlcXuVFFRr3COdAx6KKfw=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=hYNDFTZ1fbxEdxJYHqdH8NbAgmSsYb07VKv+sQP1+W7Jq8DjfpalrPvZU1ZQiYPEknfYox+skZ1oezuUgXuGPWitwtKnvzXufSSNmeh1S1LpgFsLHntYmsXFGybM69pa0ATaYpOP+dzIATExVfHBETvIUgIxXGuiC7ckmmcIB5M= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=nWpIlHMF; 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="nWpIlHMF" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 12B6DC4CEF1; Tue, 7 Oct 2025 15:26:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1759850777; bh=1egNc0S3stbS1qtX8GeMEiDlcXuVFFRr3COdAx6KKfw=; h=From:To:Cc:Subject:Date:Reply-to:From; b=nWpIlHMF8FZVA9hG/OKzBuC11qs12rCdJeTfhhkyZBdXjZXF3/tNTbw93wLB1MGCo VdSlfSaDV2l63JeFCCX4MjtCPeKpfw2ieio0sbpwz/0WV+TDbRKyBYZvdORa6ES5TR VGTSVNe2ZvkHL3c1q30siyJ1IuKlTouoG5RV/CkM= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2023-53665: md: don't dereference mddev after export_rdev() Date: Tue, 7 Oct 2025 17:21:24 +0200 Message-ID: <2025100704-CVE-2023-53665-3411@gregkh> X-Mailer: git-send-email 2.51.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=3446; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=Lbh+to6EK+C8bs/LXNkBhfVk7CgnbE5iEezwJi6uMaY=; b=owGbwMvMwCRo6H6F97bub03G02pJDBlP9R8oeH94/bWj1uSO4IwHhxaJqa+KK9yRc6X2TOJd2 Xf2RzqvdMSyMAgyMciKKbJ82cZzdH/FIUUvQ9vTMHNYmUCGMHBxCsBEVLkY5qdcjp9dM2XW16f2 01t2/5tfrcVdsYVhDseaR73vF4Zdu/A3Ktnq3eLFKut29QEA X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 Content-Transfer-Encoding: 8bit From: Greg Kroah-Hartman Description =========== In the Linux kernel, the following vulnerability has been resolved: md: don't dereference mddev after export_rdev() Except for initial reference, mddev->kobject is referenced by rdev->kobject, and if the last rdev is freed, there is no guarantee that mddev is still valid. Hence mddev should not be used anymore after export_rdev(). This problem can be triggered by following test for mdadm at very low rate: New file: mdadm/tests/23rdev-lifetime devname=${dev0##*/} devt=`cat /sys/block/$devname/dev` pid="" runtime=2 clean_up_test() { pill -9 $pid echo clear > /sys/block/md0/md/array_state } trap 'clean_up_test' EXIT add_by_sysfs() { while true; do echo $devt > /sys/block/md0/md/new_dev done } remove_by_sysfs(){ while true; do echo remove > /sys/block/md0/md/dev-${devname}/state done } echo md0 > /sys/module/md_mod/parameters/new_array || die "create md0 failed" add_by_sysfs & pid="$pid $!" remove_by_sysfs & pid="$pid $!" sleep $runtime exit 0 Test cmd: ./test --save-logs --logdir=/tmp/ --keep-going --dev=loop --tests=23rdev-lifetime Test result: general protection fault, probably for non-canonical address 0x6b6b6b6b6b6b6bcb: 0000 [#4] PREEMPT SMP CPU: 0 PID: 1292 Comm: test Tainted: G D W 6.5.0-rc2-00121-g01e55c376936 #562 RIP: 0010:md_wakeup_thread+0x9e/0x320 [md_mod] Call Trace: mddev_unlock+0x1b6/0x310 [md_mod] rdev_attr_store+0xec/0x190 [md_mod] sysfs_kf_write+0x52/0x70 kernfs_fop_write_iter+0x19a/0x2a0 vfs_write+0x3b5/0x770 ksys_write+0x74/0x150 __x64_sys_write+0x22/0x30 do_syscall_64+0x40/0x90 entry_SYSCALL_64_after_hwframe+0x63/0xcd Fix this problem by don't dereference mddev after export_rdev(). The Linux kernel CVE team has assigned CVE-2023-53665 to this issue. Affected and fixed versions =========================== Issue introduced in 6.5 with commit 3ce94ce5d05ae89190a23f6187f64d8f4b2d3782 and fixed in 6.5.5 with commit ad430ad0669d2757377373390d68e1454fc7a344 Issue introduced in 6.5 with commit 3ce94ce5d05ae89190a23f6187f64d8f4b2d3782 and fixed in 6.6 with commit 7deac114be5fb25a4e865212ed0feaf5f85f2a28 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-2023-53665 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/md/md.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/ad430ad0669d2757377373390d68e1454fc7a344 https://git.kernel.org/stable/c/7deac114be5fb25a4e865212ed0feaf5f85f2a28