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 A733A26ED3D for ; Wed, 22 Oct 2025 13:24:29 +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=1761139469; cv=none; b=Q2X2fZt/UCifrnfdNDKydOtF3lwxkez0YKDYPDof9GnE7zClsenpL+iFDk8YuNrN8TSZdElAtBBJl8UOETJGh3qDIF8EPTczWmILK9QOp57UbMcZS+WbeRzk8r2aVG3kz+eheFKw/x3Gf22J/dVDrNX04RJTWb9RYakcFUHaoPA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761139469; c=relaxed/simple; bh=RJTpfmOFiWitxfZwGt3aDAzKhe77g7O3Qt0Z6mdK8xU=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=TVK5yvl2yhFcG/inzqI9njH/2j26STOMvJAZhFFPCwICfc5RZ5MFP4s8qxsWpnXualU8lu4yA3uq7eVRfQF13El1wTlkO3BHFM/qhHC4By6fov/eOpnAl7E5/mf+t2RM5IE2BKKMcnQVdJwjuZnJKWipJm6mvXmmlfl2sRNV1oc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=i2NpNGqL; 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="i2NpNGqL" Received: by smtp.kernel.org (Postfix) with ESMTPSA id AFBF7C4CEF5; Wed, 22 Oct 2025 13:24:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1761139469; bh=RJTpfmOFiWitxfZwGt3aDAzKhe77g7O3Qt0Z6mdK8xU=; h=From:To:Cc:Subject:Date:Reply-to:From; b=i2NpNGqLtRfdFdXq+mKrczddnj37GZGyW9V2vnqR+It0+Vh9NeJAq/5B7g7VEW6CY PlyacJA5wZGIzo4YQzy/J/UxgSg/zDNKjmwZLH4wkkdZnf43r7/831dv2fkawLqW7E UD5Oc1KDivjpEziq8IyLvdlH6tMY4iJBrnLlEkeA= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2022-50566: mtd: Fix device name leak when register device failed in add_mtd_device() Date: Wed, 22 Oct 2025 15:24:14 +0200 Message-ID: <2025102207-CVE-2022-50566-9cd3@gregkh> X-Mailer: git-send-email 2.51.1 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=4547; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=ToPh538lLsWCVZXMr9RZzOPWO3cc/1l8CdQPFmlku0I=; b=owGbwMvMwCRo6H6F97bub03G02pJDBk/bn0XYvW9HvDwZtgppmAmnYyXPJf/Op/89vfe8ovea 0M2qbo964hlYRBkYpAVU2T5so3n6P6KQ4pehranYeawMoEMYeDiFICJWKUwzDO2ZiwNriuxuu27 RjZhi+1Ee6fYVIZ56pM3XWN9uXZ+2P09WpL6RvNzPj5bBQA= 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: mtd: Fix device name leak when register device failed in add_mtd_device() There is a kmemleak when register device failed: unreferenced object 0xffff888101aab550 (size 8): comm "insmod", pid 3922, jiffies 4295277753 (age 925.408s) hex dump (first 8 bytes): 6d 74 64 30 00 88 ff ff mtd0.... backtrace: [<00000000bde26724>] __kmalloc_node_track_caller+0x4e/0x150 [<000000003c32b416>] kvasprintf+0xb0/0x130 [<000000001f7a8f15>] kobject_set_name_vargs+0x2f/0xb0 [<000000006e781163>] dev_set_name+0xab/0xe0 [<00000000e30d0c78>] add_mtd_device+0x4bb/0x700 [<00000000f3d34de7>] mtd_device_parse_register+0x2ac/0x3f0 [<00000000c0d88488>] 0xffffffffa0238457 [<00000000b40d0922>] 0xffffffffa02a008f [<0000000023d17b9d>] do_one_initcall+0x87/0x2a0 [<00000000770f6ca6>] do_init_module+0xdf/0x320 [<000000007b6768fe>] load_module+0x2f98/0x3330 [<00000000346bed5a>] __do_sys_finit_module+0x113/0x1b0 [<00000000674c2290>] do_syscall_64+0x35/0x80 [<000000004c6a8d97>] entry_SYSCALL_64_after_hwframe+0x46/0xb0 If register device failed, should call put_device() to give up the reference. The Linux kernel CVE team has assigned CVE-2022-50566 to this issue. Affected and fixed versions =========================== Issue introduced in 2.6.30 with commit 1f24b5a8ecbb2a3c7080f418974d40e3ffedb221 and fixed in 4.9.337 with commit a75f45afa932bfb24a2603ebcea5efd2e7cdcfd6 Issue introduced in 2.6.30 with commit 1f24b5a8ecbb2a3c7080f418974d40e3ffedb221 and fixed in 4.14.303 with commit 2302e2dc42b1f84f951c725ce742fc21c5a1e151 Issue introduced in 2.6.30 with commit 1f24b5a8ecbb2a3c7080f418974d40e3ffedb221 and fixed in 4.19.270 with commit db07fe76df01f40cb897d6e9066b84e46957beb3 Issue introduced in 2.6.30 with commit 1f24b5a8ecbb2a3c7080f418974d40e3ffedb221 and fixed in 5.4.229 with commit fa0d32ab8407d7481450c664fd0de64f2dae9489 Issue introduced in 2.6.30 with commit 1f24b5a8ecbb2a3c7080f418974d40e3ffedb221 and fixed in 5.10.163 with commit 330bc5533e8a8ed69cb951d5a8edce9bddb9db21 Issue introduced in 2.6.30 with commit 1f24b5a8ecbb2a3c7080f418974d40e3ffedb221 and fixed in 5.15.86 with commit 71212d73184845c944ef1b43f092e643e5bde003 Issue introduced in 2.6.30 with commit 1f24b5a8ecbb2a3c7080f418974d40e3ffedb221 and fixed in 6.0.16 with commit 1b172fb05d6315ecec082fd7544a3390e96f0d7e Issue introduced in 2.6.30 with commit 1f24b5a8ecbb2a3c7080f418974d40e3ffedb221 and fixed in 6.1.2 with commit bcabe1dc2a344adbb3382930a23e273ba9382277 Issue introduced in 2.6.30 with commit 1f24b5a8ecbb2a3c7080f418974d40e3ffedb221 and fixed in 6.2 with commit 895d68a39481a75c680aa421546931fb11942fa6 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-50566 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/mtd/mtdcore.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/a75f45afa932bfb24a2603ebcea5efd2e7cdcfd6 https://git.kernel.org/stable/c/2302e2dc42b1f84f951c725ce742fc21c5a1e151 https://git.kernel.org/stable/c/db07fe76df01f40cb897d6e9066b84e46957beb3 https://git.kernel.org/stable/c/fa0d32ab8407d7481450c664fd0de64f2dae9489 https://git.kernel.org/stable/c/330bc5533e8a8ed69cb951d5a8edce9bddb9db21 https://git.kernel.org/stable/c/71212d73184845c944ef1b43f092e643e5bde003 https://git.kernel.org/stable/c/1b172fb05d6315ecec082fd7544a3390e96f0d7e https://git.kernel.org/stable/c/bcabe1dc2a344adbb3382930a23e273ba9382277 https://git.kernel.org/stable/c/895d68a39481a75c680aa421546931fb11942fa6