From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 663E3C33CB1 for ; Sun, 19 Jan 2020 15:20:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 379E2206D7 for ; Sun, 19 Jan 2020 15:20:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579447203; bh=f4kVE2F8GUiunJEdy2mdUapS9ozsQ+N2LP7rVeqi/jM=; h=Subject:To:Cc:From:Date:List-ID:From; b=Una+F/lBCfGAp0ARAxqnIoRSol3+gAIcR7eqDKvDmggoeWEcVK/Nxfk7tr6JP1WTO vAze48mv0xmG0oyGbZC7iGB2Pwif/+JG5pfCQQFI2fIMatFY30nkkMDBGlL76NiiRO jMDaRoZGBFIuY7si0Ih9/KmSkfGKFkooQpLAxYLI= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727060AbgASPUC (ORCPT ); Sun, 19 Jan 2020 10:20:02 -0500 Received: from wout2-smtp.messagingengine.com ([64.147.123.25]:33215 "EHLO wout2-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726778AbgASPUC (ORCPT ); Sun, 19 Jan 2020 10:20:02 -0500 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.west.internal (Postfix) with ESMTP id F04FC5FA; Sun, 19 Jan 2020 10:20:01 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Sun, 19 Jan 2020 10:20:02 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:message-id:mime-version:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=56ll5O b/wyU+uG7goWbKXeaBTYSU7v+HpbY1snxJmT0=; b=o2aA10IRsDgwtm8XrNZI4Q M8/vL1QaE8QdC+LrA7cLL7DWpccBZOCCQOu42c0bLPu3hq91JchgOM6nbVnuT+mH FIGlcvncD82hr1FjltaQQ02napcpjLa7dFAVG8XBz3y/CfV6gNd6TRWsUsUjFT3k 7a1TKow9SQ0EN4wIpK7wh7i+dmS4DsdBz7Xqb+S1mRH4B2GcMMa+PZDHDaaXlb0/ GQxsUl2ihd0Wjk8mlvt0LCrsfTAluZH3Ah/FqUJ9zh6siYt2XyKqKWWk3g/vTzM0 p9T4Yl9TJ6zzvurHSCHYsU64As4m6IOmecXUHt3CS1w/Wfr2ICEPyeCrJztFDw2A == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedugedrudefgdejgecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhepuffvhfffkfggtgfgsehtkeertddttd flnecuhfhrohhmpeeoghhrvghgkhhhsehlihhnuhigfhhouhhnuggrthhiohhnrdhorhhg qeenucfkphepkeegrddvgedurdduleejrdeijeenucfrrghrrghmpehmrghilhhfrhhomh epghhrvghgsehkrhhorghhrdgtohhmnecuvehluhhsthgvrhfuihiivgepfe X-ME-Proxy: Received: from localhost (unknown [84.241.197.67]) by mail.messagingengine.com (Postfix) with ESMTPA id 09E053060AA0; Sun, 19 Jan 2020 10:20:00 -0500 (EST) Subject: FAILED: patch "[PATCH] btrfs: do not delete mismatched root refs" failed to apply to 4.4-stable tree To: josef@toxicpanda.com, dsterba@suse.com Cc: From: Date: Sun, 19 Jan 2020 16:19:59 +0100 Message-ID: <1579447199148244@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org The patch below does not apply to the 4.4-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From 423a716cd7be16fb08690760691befe3be97d3fc Mon Sep 17 00:00:00 2001 From: Josef Bacik Date: Wed, 18 Dec 2019 17:20:29 -0500 Subject: [PATCH] btrfs: do not delete mismatched root refs btrfs_del_root_ref() will simply WARN_ON() if the ref doesn't match in any way, and then continue to delete the reference. This shouldn't happen, we have these values because there's more to the reference than the original root and the sub root. If any of these checks fail, return -ENOENT. CC: stable@vger.kernel.org # 4.4+ Signed-off-by: Josef Bacik Reviewed-by: David Sterba Signed-off-by: David Sterba diff --git a/fs/btrfs/root-tree.c b/fs/btrfs/root-tree.c index 3b17b647d002..612411c74550 100644 --- a/fs/btrfs/root-tree.c +++ b/fs/btrfs/root-tree.c @@ -376,11 +376,13 @@ int btrfs_del_root_ref(struct btrfs_trans_handle *trans, u64 root_id, leaf = path->nodes[0]; ref = btrfs_item_ptr(leaf, path->slots[0], struct btrfs_root_ref); - - WARN_ON(btrfs_root_ref_dirid(leaf, ref) != dirid); - WARN_ON(btrfs_root_ref_name_len(leaf, ref) != name_len); ptr = (unsigned long)(ref + 1); - WARN_ON(memcmp_extent_buffer(leaf, name, ptr, name_len)); + if ((btrfs_root_ref_dirid(leaf, ref) != dirid) || + (btrfs_root_ref_name_len(leaf, ref) != name_len) || + memcmp_extent_buffer(leaf, name, ptr, name_len)) { + err = -ENOENT; + goto out; + } *sequence = btrfs_root_ref_sequence(leaf, ref); ret = btrfs_del_item(trans, tree_root, path);