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 8B4B425FA05 for ; Tue, 16 Sep 2025 16:13:53 +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=1758039233; cv=none; b=eP+QGH0mryJXhf+wRnDy3jvXRT9Fs33Pzxt1eoCa0WrU/PiSi9+Apz3Kla4d0SHjTjtlP0TY8quTQDssnOtCD6Lg6E92rD/u/1Bxynb5TI8zOEwX+oGrWq/PAeFjEMhSrwNNKCXk25esVWTKZChjVj7phGnbboDomR9ECGsRUto= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758039233; c=relaxed/simple; bh=DrhxY7iOmWImSmunM9HlCvzLpXfS0kwBXvGz2tYokJw=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=RcWU88BfvBurUeF1tb7K7kU2dk71tW2iwPIHAQku3FB8iGPahdk26CPFlzy6wE22mSsLoMdkDbasKJDQ9pySZwYokzW0ikUCx47GVrav1KuOM0JhfQaTcrr47T3KpB0nZr+p1gE2ixG5YHL+t8bSO1mpgWWCIFX7FcCCYVaORNo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=rBJgZHkj; 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="rBJgZHkj" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 988A5C4CEEB; Tue, 16 Sep 2025 16:13:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1758039233; bh=DrhxY7iOmWImSmunM9HlCvzLpXfS0kwBXvGz2tYokJw=; h=From:To:Cc:Subject:Date:Reply-to:From; b=rBJgZHkj0t3HJlAXrN1v3CaTqhGQUdKh2v+C+BP9iZeTcEf9KNbL4ZsOAeIM8Gdw8 mcpRWt4D0ZN32SnQi9TelvLy7p41P03fzSnbaUtzBDVpJMNlBxfIbubJp3WuguSrwe zh76jv2jFFc2R6lSew/QaGNoG7OqDQrymF+0P3PQ= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2022-50342: floppy: Fix memory leak in do_floppy_init() Date: Tue, 16 Sep 2025 18:11:38 +0200 Message-ID: <2025091639-CVE-2022-50342-d7ef@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=4796; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=QRiTybFnFKsMbt5iiP3bJZJYb+XeJl8nBPq2PQD8OXY=; b=owGbwMvMwCRo6H6F97bub03G02pJDBkne6zPcDT/r1wcuKL85LS7aXFWjhPOvvfXWGlftKfFV u8Q12WrjlgWBkEmBlkxRZYv23iO7q84pOhlaHsaZg4rE8gQBi5OAZgI9yeGecrFZVzhixZYntd/ fPUDf/GbSvs0e4YF+74Ksy/vymPtcz0lUWhyfv4bkeRvAA== 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: floppy: Fix memory leak in do_floppy_init() A memory leak was reported when floppy_alloc_disk() failed in do_floppy_init(). unreferenced object 0xffff888115ed25a0 (size 8): comm "modprobe", pid 727, jiffies 4295051278 (age 25.529s) hex dump (first 8 bytes): 00 ac 67 5b 81 88 ff ff ..g[.... backtrace: [<000000007f457abb>] __kmalloc_node+0x4c/0xc0 [<00000000a87bfa9e>] blk_mq_realloc_tag_set_tags.part.0+0x6f/0x180 [<000000006f02e8b1>] blk_mq_alloc_tag_set+0x573/0x1130 [<0000000066007fd7>] 0xffffffffc06b8b08 [<0000000081f5ac40>] do_one_initcall+0xd0/0x4f0 [<00000000e26d04ee>] do_init_module+0x1a4/0x680 [<000000001bb22407>] load_module+0x6249/0x7110 [<00000000ad31ac4d>] __do_sys_finit_module+0x140/0x200 [<000000007bddca46>] do_syscall_64+0x35/0x80 [<00000000b5afec39>] entry_SYSCALL_64_after_hwframe+0x46/0xb0 unreferenced object 0xffff88810fc30540 (size 32): comm "modprobe", pid 727, jiffies 4295051278 (age 25.529s) hex dump (first 32 bytes): 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ backtrace: [<000000007f457abb>] __kmalloc_node+0x4c/0xc0 [<000000006b91eab4>] blk_mq_alloc_tag_set+0x393/0x1130 [<0000000066007fd7>] 0xffffffffc06b8b08 [<0000000081f5ac40>] do_one_initcall+0xd0/0x4f0 [<00000000e26d04ee>] do_init_module+0x1a4/0x680 [<000000001bb22407>] load_module+0x6249/0x7110 [<00000000ad31ac4d>] __do_sys_finit_module+0x140/0x200 [<000000007bddca46>] do_syscall_64+0x35/0x80 [<00000000b5afec39>] entry_SYSCALL_64_after_hwframe+0x46/0xb0 If the floppy_alloc_disk() failed, disks of current drive will not be set, thus the lastest allocated set->tag cannot be freed in the error handling path. A simple call graph shown as below: floppy_module_init() floppy_init() do_floppy_init() for (drive = 0; drive < N_DRIVE; drive++) blk_mq_alloc_tag_set() blk_mq_alloc_tag_set_tags() blk_mq_realloc_tag_set_tags() # set->tag allocated floppy_alloc_disk() blk_mq_alloc_disk() # error occurred, disks failed to allocated ->out_put_disk: for (drive = 0; drive < N_DRIVE; drive++) if (!disks[drive][0]) # the last disks is not set and loop break break; blk_mq_free_tag_set() # the latest allocated set->tag leaked Fix this problem by free the set->tag of current drive before jump to error handling path. [efremov: added stable list, changed title] The Linux kernel CVE team has assigned CVE-2022-50342 to this issue. Affected and fixed versions =========================== Issue introduced in 5.11 with commit 302cfee150291c6cd85b1ca197d062d0b423d09c and fixed in 5.15.86 with commit f36d8c8651506aea5f09899f5356ece5d1384f50 Issue introduced in 5.11 with commit 302cfee150291c6cd85b1ca197d062d0b423d09c and fixed in 6.0.16 with commit 75d8c8851a4da0190c2480e84315b5fd3d0356c5 Issue introduced in 5.11 with commit 302cfee150291c6cd85b1ca197d062d0b423d09c and fixed in 6.1.2 with commit 55b3c66a0d441cd37154ae95e44d0b82ccfd580e Issue introduced in 5.11 with commit 302cfee150291c6cd85b1ca197d062d0b423d09c and fixed in 6.2 with commit f8ace2e304c5dd8a7328db9cd2b8a4b1b98d83ec 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-50342 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/block/floppy.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/f36d8c8651506aea5f09899f5356ece5d1384f50 https://git.kernel.org/stable/c/75d8c8851a4da0190c2480e84315b5fd3d0356c5 https://git.kernel.org/stable/c/55b3c66a0d441cd37154ae95e44d0b82ccfd580e https://git.kernel.org/stable/c/f8ace2e304c5dd8a7328db9cd2b8a4b1b98d83ec