From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796385560; b=2PBtBTmIYZD3B4LQTOeEG47unQW1ihuk43ZF227CTcS1iAmAuu0jqDXSMoi/FyX1TGuv d8Hj0+MGpoAgKMKF+lsk7EJiVi2p6BZ9i8TQLE5MH+uP8E2w4cMISCMkqjPPvHBz5ZQHJ iEt+a0UKAYSaB+bzZmHYuAnmUstG1/ki0q4Eakj1+juCMaeYcI+lbJXY/XfvOK+lLZjba WfxvMwQD6yBMxn2/YyD2zXZyBLZn6Y8p/HrDYUjBn0lRUObbHFxLYp6Djp/Xj+eEjRZ6B 52hjZqEmo36nIP1POlX0enE0kTlM1XIZOvwyAX9+BVRQZPsIDlhY1/1PgTfEyXvBJdQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796385560; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=Q/lWzfE+fbPf36Pawitys/7G1BS5qMto6NdvvhB3txI=; b=X02ZGy6AaxgeSwxNAvpYNfnLI/Z2BKiVcaaD8YcYeoO5swmQYCtbWhIgG2cUCqmsuUkX A65BuUtZje30NXyRWsk65118cAc3S08UbCqfBAwVF2EYxouKYWzjvX9af+hd5/ycvk8GC 3c3wgOytrgjZa9Z2nt77l4Hsg64sUWkwyUQwPZIGmEQuJhoCqZyGOCJYLIRC2uULUKa6T B9klsIrh946KJRDlFSSHxcPlTMcJEH3SvlpZo6rQ0egSwd2Sfl+aig38OH+3xcOkpcg1U Nod/oY9stoFqh5r24KyxLmI/iFftbDAiYqj+zf6HLGNJO6zeoCZD1TK87H85y2zFuYg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=dXjgpa01; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 983FC606A322; Fri, 4 Dec 2026 11:59:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=dXjgpa01 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 756AF1F000C2; Fri, 4 Dec 2026 11:59:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796385559; bh=Q/lWzfE+fbPf36Pawitys/7G1BS5qMto6NdvvhB3txI=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=dXjgpa01NSscoAzWR8fLDnAz4BF+xvnj4ypz62Beq06QG2OZVZ+2572obbr6JLolN joxVyZgfN7Ex+RPhgbZ6+ol8ngEpCe0aoEo4ZOF8VB6jjGNLYDoel3zT+AOk8937gM zpjTCyYxQzqa7BqBZfG+OMxRrgesvJt8ZDDHoGyA= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Shao Mingyin , Mikulas Patocka Subject: [PATCH 6.6 0601/1167] dm log userspace: drop the device reference on error Date: Fri, 4 Dec 2026 19:00:28 +0900 Message-ID: <20261204100717.712165193@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100702.047403948@linuxfoundation.org> References: <20261204100702.047403948@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: shao.mingyin@zte.com.cn commit 0550d3b14e008b033b02cfce668008ec6addffe4 upstream. userspace_ctr() takes a reference on the log device with dm_get_device(). When the integrated-flush workqueue allocation fails it jumps to the shared error path, which frees the log context without dropping that reference, so the device stays busy and cannot be removed. userspace_dtr() drops the reference correctly; do the same here. Fixes: 5066a4df1f42 ("dm log userspace: allow mark requests to piggyback on flush requests") Cc: stable@vger.kernel.org Signed-off-by: Shao Mingyin Signed-off-by: Mikulas Patocka Signed-off-by: Greg Kroah-Hartman --- drivers/md/dm-log-userspace-base.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) --- a/drivers/md/dm-log-userspace-base.c +++ b/drivers/md/dm-log-userspace-base.c @@ -294,9 +294,11 @@ static int userspace_ctr(struct dm_dirty } r = dm_get_device(ti, devices_rdata, dm_table_get_mode(ti->table), &lc->log_dev); - if (r) + if (r) { DMERR("Failed to register %s with device-mapper", devices_rdata); + goto out; + } } if (lc->integrated_flush) { @@ -314,6 +316,8 @@ static int userspace_ctr(struct dm_dirty out: kfree(devices_rdata); if (r) { + if (lc->log_dev) + dm_put_device(lc->ti, lc->log_dev); mempool_exit(&lc->flush_entry_pool); kfree(lc); kfree(ctr_str);