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 373A62D24AC for ; Wed, 24 Dec 2025 13:06:57 +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=1766581618; cv=none; b=gCFq5O++4OW+7DKCfMCDpZzUV7SJ5A7c+00i3wVe1Rf+XTgrtkT7x9afADx5PFiBOS97m7O5jWi1roCUSUDTCi4P8C4tisBD+8Kwkd4JrOGI89uF6WD7vudOs4TVX0yhLGY0Fas+dVQDtGYlBGfxRkTZB291h7WESnMT8k5XgNo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766581618; c=relaxed/simple; bh=ytesQiMSL1TwwcL7JwboK58R8xZsJDQiOHQuKDAaHfM=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=QH450hNhAi3bX/7zpTjs9pGpZdauLtWB2l1thiRHzPFWeuQ9xJWPBH7xKJ6ZGjJLt9mkGXZP2LKdb8atNeeOitXasAFHIbtMP1yRcqT0BVsrTMEsrw0o8OuMH1GzX6kZYVYEUp6e1ZtbssDV+In4zE603AGzg0rOso7ihF76YTQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=M90F+G0y; 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="M90F+G0y" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 76B7CC4CEFB; Wed, 24 Dec 2025 13:06:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1766581617; bh=ytesQiMSL1TwwcL7JwboK58R8xZsJDQiOHQuKDAaHfM=; h=From:To:Cc:Subject:Date:Reply-To:From; b=M90F+G0ySldnpxOwS2PIdOwpOOW+R0zYJIarvQNNPok/MjKBXfViX3RWmEd+JnsCg k1F2aVz34PxPw/i0J/sT8zLad1m4YB8U/kjPWaJAr+Q7XFw4bk+vF+yQzHZG6VgAPO P1yZVwwohL8upsImv0npMDsW3TR6YgyX5ijyL93M= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2022-50752: md/raid5: Remove unnecessary bio_put() in raid5_read_one_chunk() Date: Wed, 24 Dec 2025 14:06:03 +0100 Message-ID: <2025122452-CVE-2022-50752-fa82@gregkh> X-Mailer: git-send-email 2.52.0 Reply-To: , Precedence: bulk X-Mailing-List: linux-cve-announce@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=5369; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=zjzEX/Jq1f3wgAWRDJzlyIamZOUQyllGj0el6lnxhkM=; b=owGbwMvMwCRo6H6F97bub03G02pJDJneTw2C8rKLTv6e83/+g/9O/FoJGycuWnha4sDSXsXET S4XxISkO2JZGASZGGTFFFm+bOM5ur/ikKKXoe1pmDmsTCBDGLg4BWAiVy4zzDNde7qpsKn4svo8 hcptXppi4pNTNjLMFdVxmn830bHw6crqpNxFzy/+vOKiDAA= 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/raid5: Remove unnecessary bio_put() in raid5_read_one_chunk() When running chunk-sized reads on disks with badblocks duplicate bio free/puts are observed: ============================================================================= BUG bio-200 (Not tainted): Object already free ----------------------------------------------------------------------------- Allocated in mempool_alloc_slab+0x17/0x20 age=3 cpu=2 pid=7504 __slab_alloc.constprop.0+0x5a/0xb0 kmem_cache_alloc+0x31e/0x330 mempool_alloc_slab+0x17/0x20 mempool_alloc+0x100/0x2b0 bio_alloc_bioset+0x181/0x460 do_mpage_readpage+0x776/0xd00 mpage_readahead+0x166/0x320 blkdev_readahead+0x15/0x20 read_pages+0x13f/0x5f0 page_cache_ra_unbounded+0x18d/0x220 force_page_cache_ra+0x181/0x1c0 page_cache_sync_ra+0x65/0xb0 filemap_get_pages+0x1df/0xaf0 filemap_read+0x1e1/0x700 blkdev_read_iter+0x1e5/0x330 vfs_read+0x42a/0x570 Freed in mempool_free_slab+0x17/0x20 age=3 cpu=2 pid=7504 kmem_cache_free+0x46d/0x490 mempool_free_slab+0x17/0x20 mempool_free+0x66/0x190 bio_free+0x78/0x90 bio_put+0x100/0x1a0 raid5_make_request+0x2259/0x2450 md_handle_request+0x402/0x600 md_submit_bio+0xd9/0x120 __submit_bio+0x11f/0x1b0 submit_bio_noacct_nocheck+0x204/0x480 submit_bio_noacct+0x32e/0xc70 submit_bio+0x98/0x1a0 mpage_readahead+0x250/0x320 blkdev_readahead+0x15/0x20 read_pages+0x13f/0x5f0 page_cache_ra_unbounded+0x18d/0x220 Slab 0xffffea000481b600 objects=21 used=0 fp=0xffff8881206d8940 flags=0x17ffffc0010201(locked|slab|head|node=0|zone=2|lastcpupid=0x1fffff) CPU: 0 PID: 34525 Comm: kworker/u24:2 Not tainted 6.0.0-rc2-localyes-265166-gf11c5343fa3f #143 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.13.0-1ubuntu1.1 04/01/2014 Workqueue: raid5wq raid5_do_work Call Trace: dump_stack_lvl+0x5a/0x78 dump_stack+0x10/0x16 print_trailer+0x158/0x165 object_err+0x35/0x50 free_debug_processing.cold+0xb7/0xbe __slab_free+0x1ae/0x330 kmem_cache_free+0x46d/0x490 mempool_free_slab+0x17/0x20 mempool_free+0x66/0x190 bio_free+0x78/0x90 bio_put+0x100/0x1a0 mpage_end_io+0x36/0x150 bio_endio+0x2fd/0x360 md_end_io_acct+0x7e/0x90 bio_endio+0x2fd/0x360 handle_failed_stripe+0x960/0xb80 handle_stripe+0x1348/0x3760 handle_active_stripes.constprop.0+0x72a/0xaf0 raid5_do_work+0x177/0x330 process_one_work+0x616/0xb20 worker_thread+0x2bd/0x6f0 kthread+0x179/0x1b0 ret_from_fork+0x22/0x30 The double free is caused by an unnecessary bio_put() in the if(is_badblock(...)) error path in raid5_read_one_chunk(). The error path was moved ahead of bio_alloc_clone() in c82aa1b76787c ("md/raid5: move checking badblock before clone bio in raid5_read_one_chunk"). The previous code checked and freed align_bio which required a bio_put. After the move that is no longer needed as raid_bio is returned to the control of the common io path which performs its own endio resulting in a double free on bad device blocks. The Linux kernel CVE team has assigned CVE-2022-50752 to this issue. Affected and fixed versions =========================== Issue introduced in 5.14 with commit c82aa1b76787c34fd02374e519b6f52cdeb2f54b and fixed in 5.15.75 with commit 7a37c58ee72e1fadd22c4ee990cb74c2ca2280e7 Issue introduced in 5.14 with commit c82aa1b76787c34fd02374e519b6f52cdeb2f54b and fixed in 5.19.17 with commit c0fd5d4d8fd7b1a50306d7a23c720cf808f41fdf Issue introduced in 5.14 with commit c82aa1b76787c34fd02374e519b6f52cdeb2f54b and fixed in 6.0.3 with commit 21a9c7354aa59e97e26ece5f0a609c8bfa43020d Issue introduced in 5.14 with commit c82aa1b76787c34fd02374e519b6f52cdeb2f54b and fixed in 6.1 with commit c66a6f41e09ad386fd2cce22b9cded837bbbc704 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-50752 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/raid5.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/7a37c58ee72e1fadd22c4ee990cb74c2ca2280e7 https://git.kernel.org/stable/c/c0fd5d4d8fd7b1a50306d7a23c720cf808f41fdf https://git.kernel.org/stable/c/21a9c7354aa59e97e26ece5f0a609c8bfa43020d https://git.kernel.org/stable/c/c66a6f41e09ad386fd2cce22b9cded837bbbc704