Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp403605pxu; Tue, 1 Dec 2020 14:23:22 -0800 (PST) X-Google-Smtp-Source: ABdhPJy5hXqwshS8q8wOwCdtOYlN7KKJ1Sxd4gA1pW5vA2ZzmnsE/M84z5u4/tAvhDcxVplpmp5f X-Received: by 2002:a17:906:1498:: with SMTP id x24mr5152040ejc.170.1606861402613; Tue, 01 Dec 2020 14:23:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606861402; cv=none; d=google.com; s=arc-20160816; b=fnBYVkLIaTgzFjEAnfQPxKXfJhaVTVdowvq3n0HjC5nvApqmPPAMfYGiS6cwZ2JCjP NU1mYYk4NNxkhG2qPlo9H1y+vrZIDpFf29fVX681KDHfcyLr+/bZGRtwmufxV9gRW043 nhLfoI4jTNWWhL4HDYWGyszz5L62a/jVHg0Lu2iEkM+MYCpdKleeent9bOFe6yiDf3mG HT44UmAsoHsSe95TWYPI8kNw+0dOVbCSYy6/uUX1lnO1W8aQJO9tiCTBLjIBYh9dzJsF 91xXy7yy+xRsvY3buSPSNG+mcNTStm0L2q0utuGhFAklorxiucRqw63DbBinfpxTl9E6 G7dA== 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=4NZ9MjdgZiCN/ocIQCRnTFxx9Hpc31bBt7KqNpVzVd0=; b=hivD5KRuu77ecHZMR3xxS3mFRoCbZD30gOAz6vQpXQ9L5weXhSeqboaRyCkRXciqhh akd+1O5IE0PdnohgI808L5peC59w3N0p3r/qpr4zuuNT64xpsn5QHzu33UUTarZlSGFQ jjxSlLHIZEHCgJtW43+KmGJ0IEL2q5QDRwaDm/8AoeJnY2p99IF+Dre5RXxzJ7oAaJ3M VxYHfRJ/uG2Vkj5QazKBiCI8D3wow0qHBrI+86zk1h8SpnvoSc8lopT+uNXtMX6P1Wl1 Dm1B+XIRLAlPrRvJSTgGXJqz1wz6NL6wyL49vMyvqfcYqvfPGC7syH6z1OuY8yE8MMG/ 8kCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=E4LPKDwu; 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 ck15si796434edb.37.2020.12.01.14.23.00; Tue, 01 Dec 2020 14:23:22 -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=E4LPKDwu; 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 S2388762AbgLAJGV (ORCPT + 99 others); Tue, 1 Dec 2020 04:06:21 -0500 Received: from mail.kernel.org ([198.145.29.99]:41148 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388742AbgLAJEB (ORCPT ); Tue, 1 Dec 2020 04:04:01 -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 869E021D7A; Tue, 1 Dec 2020 09:03:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1606813401; bh=veCYHlh7l15PtiqJIlmQ6yp5nRxo44mzuSK+BrP1wuA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=E4LPKDwu8qBU8vXfFaJF5a7RdzcFQUQ01bEdtinjvNEi691RBQtqWl3oUpkbC3bmE 2HwoyTDdYIQm1+92e8BA3+o0qg4yN24Z/ZGdXMsiqx9T/D8YOwgaUVYYgHx/4nvJdd /SnGRNm1TaQZDfz0nJYqdqo2TZ+m+CiaWMmJX9gg= 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.4 06/98] btrfs: tree-checker: add missing returns after data_ref alignment checks Date: Tue, 1 Dec 2020 09:52:43 +0100 Message-Id: <20201201084653.476053306@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201201084652.827177826@linuxfoundation.org> References: <20201201084652.827177826@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 @@ -1269,6 +1269,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, @@ -1297,6 +1298,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;