Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp404892pxu; Tue, 1 Dec 2020 14:25:34 -0800 (PST) X-Google-Smtp-Source: ABdhPJxSvzR7t2lYac9SS0BJ/d3lbyJc5FgRWJeRyrdGrJVzUvB1aia85zMazDtUhW69+tj10KRf X-Received: by 2002:aa7:d3cc:: with SMTP id o12mr5490047edr.235.1606861534058; Tue, 01 Dec 2020 14:25:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606861534; cv=none; d=google.com; s=arc-20160816; b=MTPFezdci6WIzCCzIjgVJFsJltWof+J83mjZN4QfJqjRqw/8tyyuHoBlXnW6exvbci h1FVM90rmFuoKeACMDJ66hLWQ5nbDqgMwoC6npTg1n9SCwRYSpiCyu9MmGoZ8gX9lmoZ CoYvuGftfwUzD3pQ/AzWLMFRsI6OZs12UUw/pf3XvZww2IgEaLph055e5FyMILSVXjC/ m++sFOloMeehqz93HyrTIrah68EsLX2J6G0LxyOm6Qpia3MqFY3OaQE9QdEMfJBnqLRm h5Lg7Z9HUX07T0C7DpHYc2r8Is6U5ASzyyXR0gH7mkI57f8e/AvGZ+8sMJffrljPIZOD RcpA== 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=oXwL+SPjpdkMwlnwTNt6q+dVrgL69P3C3KcACqHRmTI=; b=WxmWtrWUwlkhh73SfKEdwQQWh59/TdsMN/YFKxBo8JVwsPIlbSCpo/KxS/zc2amVCX VKRdCqPmVK5oALdTB0tOA2bHCzTPUmnSoM3af0kXOy0Ta9zFNUiPq5eDza544KPH1bfF HCCLCPVB/HWrfN+gAQLnClaqwxvwwqr5whb4s0Ct1K9VZOmchct4Ek1F+5qYtUzWU5gt vyDzdH5tFLkeF+MWA7Qgc1FkwNfMZk+0llPIX24xHglFYfzlwxdoNUivWij8q9WZT5PO DxBt79OKAGFor4tSsplvOlH0axBVhgTTWri1FavLGTSTz796VGp8gCSAzS6i0OhpLo4W KHyA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="1MutG/cB"; 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 k17si805215edf.245.2020.12.01.14.25.11; Tue, 01 Dec 2020 14:25:34 -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="1MutG/cB"; 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 S2389648AbgLAJKK (ORCPT + 99 others); Tue, 1 Dec 2020 04:10:10 -0500 Received: from mail.kernel.org ([198.145.29.99]:47620 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389625AbgLAJKD (ORCPT ); Tue, 1 Dec 2020 04:10:03 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 506EF206C1; Tue, 1 Dec 2020 09:09:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1606813763; bh=OAQIJEwitXy6/0c5JnDfUIgAoSbJbDMtECgs1JZgF98=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1MutG/cBPDz2eEnRR0usuJGsZF79S5TToKI2p5rAn1+01F5To3y1QALt0sBa9JtMw sVCXveNqFytB/qLGW6+SXUl13HNCYPozcMtbKEbbcy0akPLVLyFEs1wgngVRMwspq3 orl1JNoltYPvZyUIG8vRRAI9xCBi+2+mVs+zjjoY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Qu Wenruo , David Sterba Subject: [PATCH 5.9 010/152] btrfs: tree-checker: add missing returns after data_ref alignment checks Date: Tue, 1 Dec 2020 09:52:05 +0100 Message-Id: <20201201084713.183943293@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201201084711.707195422@linuxfoundation.org> References: <20201201084711.707195422@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: David Sterba commit 6d06b0ad94d3dd7e3503d8ad39c39c4634884611 upstream. There are sectorsize alignment checks that are reported but then check_extent_data_ref continues. This was not intended, wrong alignment is not a minor problem and we should return with error. CC: stable@vger.kernel.org # 5.4+ Fixes: 0785a9aacf9d ("btrfs: tree-checker: Add EXTENT_DATA_REF check") Reviewed-by: Qu Wenruo Signed-off-by: David Sterba Signed-off-by: Greg Kroah-Hartman --- fs/btrfs/tree-checker.c | 2 ++ 1 file changed, 2 insertions(+) --- a/fs/btrfs/tree-checker.c +++ b/fs/btrfs/tree-checker.c @@ -1424,6 +1424,7 @@ static int check_extent_data_ref(struct "invalid item size, have %u expect aligned to %zu for key type %u", btrfs_item_size_nr(leaf, slot), sizeof(*dref), key->type); + return -EUCLEAN; } if (!IS_ALIGNED(key->objectid, leaf->fs_info->sectorsize)) { generic_err(leaf, slot, @@ -1452,6 +1453,7 @@ static int check_extent_data_ref(struct extent_err(leaf, slot, "invalid extent data backref offset, have %llu expect aligned to %u", offset, leaf->fs_info->sectorsize); + return -EUCLEAN; } } return 0;