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 0AE29C33CB1 for ; Sun, 19 Jan 2020 15:20:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D462E2071C for ; Sun, 19 Jan 2020 15:20:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579447206; bh=jYvv5n3CuW6cDYqG23cPFP7c6ljPigPyPo1NEmIQ+20=; h=Subject:To:Cc:From:Date:List-ID:From; b=JFLmSAsY1cNyH6wNUqlm4KRl4jgJrOQ60q25SqR4/zRB2s+K3CmnmDoj58KMimnM3 JiLhyPsOmQ4phgmdLVzXQPZ3VMQR6t3yd+AplOB+9/CKmK2PVioADvTsIW9LxvForl FV3Ujs3dUPfrwr8f8g6gUokvYT5zie+3KVrIuTLA= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726778AbgASPUG (ORCPT ); Sun, 19 Jan 2020 10:20:06 -0500 Received: from wout2-smtp.messagingengine.com ([64.147.123.25]:33429 "EHLO wout2-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727075AbgASPUG (ORCPT ); Sun, 19 Jan 2020 10:20:06 -0500 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.west.internal (Postfix) with ESMTP id 64A1E603; Sun, 19 Jan 2020 10:20:05 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Sun, 19 Jan 2020 10:20:05 -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=F+D/+8 2MQByWMjgOygN0dW9fN+w3vp8Bi+MvCZBUY18=; b=JoJuWHSHApPzWEW4jL1OCT 8CyQ/F3RP9RFxMlmuFC5yuWx2Ai8BOse1x/Als0s2uIRKAEHUTlAlb96whU58KUu KuyTYoTkDmE6BOZhjiaf3D4d/8FQyjwpd1QE1BhOBueWjtLkVdFPzeX3VozTC6nd oXlWW4PnWajzAr/yZ/E2IMk7NLBritddHio0WUIHzdZC5xvmIk9BORuOQfWL+/dp Ll66XphIrYU0H6jQrfAQsfEVkDoOBoRWUeE4unGcWwwzJJ4f6EKpamRJ/26HbHf3 Ddo+yCabPPx7HjNUbsfo4XDXAcjm+b/U8tiuL+vw5Kr3cJuycS+caOHJR7e6Iwbg == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedugedrudefgdejgecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhepuffvhfffkfggtgfgsehtkeertddttd flnecuhfhrohhmpeeoghhrvghgkhhhsehlihhnuhigfhhouhhnuggrthhiohhnrdhorhhg qeenucfkphepkeegrddvgedurdduleejrdeijeenucfrrghrrghmpehmrghilhhfrhhomh epghhrvghgsehkrhhorghhrdgtohhmnecuvehluhhsthgvrhfuihiivgepge X-ME-Proxy: Received: from localhost (unknown [84.241.197.67]) by mail.messagingengine.com (Postfix) with ESMTPA id 190B380062; Sun, 19 Jan 2020 10:20:03 -0500 (EST) Subject: FAILED: patch "[PATCH] btrfs: do not delete mismatched root refs" failed to apply to 4.9-stable tree To: josef@toxicpanda.com, dsterba@suse.com Cc: From: Date: Sun, 19 Jan 2020 16:20:00 +0100 Message-ID: <1579447200198127@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.9-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);