Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3593829pxb; Mon, 24 Jan 2022 13:04:32 -0800 (PST) X-Google-Smtp-Source: ABdhPJwUbJUqWuhRD5BCT+GMaFRk7lkEM2lO9JNkaPvnyP1WXVH3ishLwLDcmwkx+4i0OXKbopCv X-Received: by 2002:a17:902:be08:b0:14b:7036:3573 with SMTP id r8-20020a170902be0800b0014b70363573mr969087pls.155.1643058272389; Mon, 24 Jan 2022 13:04:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643058272; cv=none; d=google.com; s=arc-20160816; b=upmbeyJfgEg5b/g6sbqMCVaO4n4VD96tmDxqmfC5yow3z11QUUhI63W+ZbKpn3xq+O OnVDyqqkQLeTAEmJRxjm9o9Y1VhJ4dsPLV2OAyoQxUXPbtaY61OLhxFCsxE3c+KP3ojo L4vy0y6U4fvYj6zxOh+rPv/sBKHIbvffH2cDDowTQc8thsMEwtRzvx0etLSF/OKwBpeh IO2VgUc1cBFU85j1BvMfIfMVHAXf2nwhqPhZx06Q5T1TbEjQfefAIllMZaLQNBK5zcvx pHVlcksSEqMaBegEn2pJHe/PxPZU1dQ3mwZqKK5QBlsDmaOLH1YWs9Rby8+DEiq5Jdo6 4Qcg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=AeFQF7eQsFYOZJ9QHgaOTBVxfeq7JGGkUd/C0k1ptrM=; b=h4//AAuCa4bfcLTZgpwIta5jzjo681nFm6TpbqFJbfeXtJLE2bWW0Rtqz0yIgk0Y4l iNSDnAD9OSImWVp/AY0ESIfDEuD2OD34mnW3d3/HepL6hraieutY8rNtelTKms7A5Kef IRIhifJqg+hQX8dYjCjaPaAdrp7wtUs0qTjKY737BdXKPd53YQ3VXuV1Rph0LuQEvFRG kb7oUWj4SVxlSwfLR6DMZ6Oc77j7GxM3NRvW3v3PI4ZeUH3vcSJlPOnDspmHSoCbEe33 a47Ajdb2h3Ybgboh7HUAWyhOR5wJrH4FEaFo7FVq7LYcuOfHw2tjxoW/2AFmg6x/V3me bdzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=iKB8KfNX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u22si1888685pfg.2.2022.01.24.13.04.20; Mon, 24 Jan 2022 13:04:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=iKB8KfNX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1382283AbiAXUZY (ORCPT + 99 others); Mon, 24 Jan 2022 15:25:24 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:59122 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376550AbiAXUCk (ORCPT ); Mon, 24 Jan 2022 15:02:40 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 94E0A612F0; Mon, 24 Jan 2022 20:02:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7774AC340E5; Mon, 24 Jan 2022 20:02:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643054556; bh=FaYKt4gnTfuF6TjBBOx0FbqMFJY4EXOhStDyYJlL4e8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iKB8KfNX4iAHe6TTPuDB3xahPBC9jaZ8q3WIJ7wQHQ3FYNL6wmJVe9WT5J79Zj8Po 9B6Lb+22nrnza0TAvDtOIgcFppGquIEMwN/5VXys7Il5wWhGkmOfqDh7TXr6SIFPKr Qes09vYJbT2zdqI9pa7+jwHaSf76E5p9bQ7j4Vpc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Josef Bacik , David Sterba , Sasha Levin Subject: [PATCH 5.10 394/563] btrfs: remove BUG_ON(!eie) in find_parent_nodes Date: Mon, 24 Jan 2022 19:42:39 +0100 Message-Id: <20220124184038.060803830@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184024.407936072@linuxfoundation.org> References: <20220124184024.407936072@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Josef Bacik [ Upstream commit 9f05c09d6baef789726346397438cca4ec43c3ee ] If we're looking for leafs that point to a data extent we want to record the extent items that point at our bytenr. At this point we have the reference and we know for a fact that this leaf should have a reference to our bytenr. However if there's some sort of corruption we may not find any references to our leaf, and thus could end up with eie == NULL. Replace this BUG_ON() with an ASSERT() and then return -EUCLEAN for the mortals. Signed-off-by: Josef Bacik Reviewed-by: David Sterba Signed-off-by: David Sterba Signed-off-by: Sasha Levin --- fs/btrfs/backref.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/fs/btrfs/backref.c b/fs/btrfs/backref.c index 8b471579e26e1..baff31a147e7d 100644 --- a/fs/btrfs/backref.c +++ b/fs/btrfs/backref.c @@ -1366,10 +1366,18 @@ again: goto out; if (!ret && extent_item_pos) { /* - * we've recorded that parent, so we must extend - * its inode list here + * We've recorded that parent, so we must extend + * its inode list here. + * + * However if there was corruption we may not + * have found an eie, return an error in this + * case. */ - BUG_ON(!eie); + ASSERT(eie); + if (!eie) { + ret = -EUCLEAN; + goto out; + } while (eie->next) eie = eie->next; eie->next = ref->inode_list; -- 2.34.1