From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 F259643E487; Thu, 30 Jul 2026 14:20:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785421204; cv=none; b=DdoEyDNfobxGQodySedW2I7J8Gn2gSyWS5W+lBpUPqSG9xuAOke5gpkmmap9vJ1OUZ/dgcJYUxaj2y0ZFj0hnRxHVctz46OL/xSjU9k0HcQ1IoD/RWSACvp7HgWbY6kjypS8rnuPzsMyDmoBVrZurT6QRH4q1+M+N9cUIQRLDYQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785421204; c=relaxed/simple; bh=H50xPfxPV2WZxgwSda4Bi+nG6GWnr3cRVEZkO0oeZZ0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=HM/ck52/jOrAm5V0T4iN3vFSAcRJrfkC/3iC1mgagGA0APspar8Na3Jp6uJR7m8FU3s2T3iQ/oZx+3hPty621hxsZ9EymOAIr/BHq1mXY8XtMrcVlZswdzGGSetsYhH9WlufbLssGtwXoClBzL9j9tVFG/E5U30b2O+o7tkRTG4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=QCN/d3me; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="QCN/d3me" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 39DDB1F000E9; Thu, 30 Jul 2026 14:20:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1785421202; bh=tyNK1htjBRaatySAONDwa1zy0o27g2KthkWsbAINT8E=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=QCN/d3me+O9Y2UhOORPQexPnNxFP5EEY/t3by1ksljCKodQjf0loqsIWr4EUPDy2B 8yI9Wd8P91sq986TjG6/LZ00++YS5xaGlp6mHyZqnqkgzwaLmKcez60795EjhQCOvt WyO1zdLUdaot1+K17FI6ogFYPO8NdIYwAIlCsd9c= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Qu Wenruo , Johannes Thumshirn , Filipe Manana , David Sterba , Sasha Levin Subject: [PATCH 7.1 025/744] btrfs: fix root leak if its reloc root is unexpected in merge_reloc_roots() Date: Thu, 30 Jul 2026 16:04:58 +0200 Message-ID: <20260730141444.818606895@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260730141444.267951807@linuxfoundation.org> References: <20260730141444.267951807@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 7.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Filipe Manana [ Upstream commit ce6050bafb4e33377dc17fcc357736bfc351180c ] If we have an unexpected reloc_root for our root, we jump to the out label but never drop the reference we obtained for root, resulting in a leak. Add a missing btrfs_put_root() call. Fixes: 24213fa46c70 ("btrfs: do proper error handling in merge_reloc_roots") Reviewed-by: Qu Wenruo Reviewed-by: Johannes Thumshirn Signed-off-by: Filipe Manana Reviewed-by: David Sterba Signed-off-by: David Sterba Signed-off-by: Sasha Levin --- fs/btrfs/relocation.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c index 3ebaf5880125fa..6c826be4174934 100644 --- a/fs/btrfs/relocation.c +++ b/fs/btrfs/relocation.c @@ -1850,6 +1850,7 @@ void merge_reloc_roots(struct reloc_control *rc) * corruption, e.g. bad reloc tree key offset. */ ret = -EINVAL; + btrfs_put_root(root); goto out; } ret = merge_reloc_root(rc, root); -- 2.53.0