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=1796388289; b=1dNNlOk0fbZvSbuq1gCDSDGMF+PjdXIvYMJN2D7QDSzMVa34rOomSLR+cntV9vcOyJrp KOrdN31dzA4yjVgQ1D7Bbp3FQyinkJub+OVqC4I1ZRZrHzvKyZobk4H2azZsUVeTiwCE4 4FdgXcrInhPBD3iAuVOnld7BaAeaukKO1S5IKjCr5+LUnfqKXAvD4VwyBAaTdn12vurtz viO4vjyYElH3547C3e66aB21FGrExR22O9aREpgGeByjFXdk8gUtl1h7ji06JkWJC2DZF I9Xi9PUGstkKVJdQV1fz5nGYm6/VJqkC1dqdJ7mdCsRcF9a4MSxy9wqidP07PS3olTg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796388289; 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=f7bfY6NJ2pDejenvAG3jizv2VN5gqGJ2zgnfkD9gGik=; b=MnB8fsdtslkkRcov78FknufLU9841X/wzxwFeSVFv4wVlHM6dBoIkur/fIgGqhPXuIUz +IcXJJgcCcCqxq+89V0lggOvTroT1WST8D+FR0ixvu+3U5TyF4XGbE8vY+2nf/6/wB3tT kPBOV3s56fueswsK7LH6qOD4Q0OFmCh4GHXE7x1X+Yx1IXypk3/hgG2l/7z3VreCPEcDf dNmfGHOV4mN2OwJ2kZAk17IbiZ9n7b3jshBLoBvBemMVERz/XJ6L8U2fi6vieAPUpeXE4 FimlhWyHdzqV0woF8woY7vvsnt4TDNrgwySHQykvWrN3ogw8WuG28+4k1aVPsBYh0fw== 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=1a2k8ZtG; 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 ECC27606A33E; Fri, 4 Dec 2026 12:44:48 +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=1a2k8ZtG Received: by smtp.kernel.org (Postfix) with ESMTPSA id 67A1F1F0093B; Fri, 4 Dec 2026 12:44:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796388288; bh=f7bfY6NJ2pDejenvAG3jizv2VN5gqGJ2zgnfkD9gGik=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=1a2k8ZtGAb3XkA9njieRa6y+Wmu3OlsC/MgTYlPA/9hDzv5k1vhmoSIg7Hzif6Kyd Djo9mf3S5mga5tb++dAUlKJyEHcMGpTgXiF+zAEN5GMA8apPNwSpScvZTsiQlR+0zr 8xMxO6484zKL22VxY6s+DWOxRtKThrRWXdX5pEDU= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Shao Mingyin , Mikulas Patocka Subject: [PATCH 6.1 0558/1059] dm log userspace: drop the device reference on error Date: Fri, 4 Dec 2026 19:01:29 +0900 Message-ID: <20261204100658.633433671@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100643.980430235@linuxfoundation.org> References: <20261204100643.980430235@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.1-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 @@ -293,9 +293,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) { @@ -313,6 +315,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);