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=-7.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,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 53C66C43381 for ; Wed, 20 Mar 2019 19:21:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 268CF21841 for ; Wed, 20 Mar 2019 19:21:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1553109672; bh=wGvhbXXvJsZ/gyyjsMj9v3o8T1D72//3aICuJck4G6g=; h=Subject:To:Cc:From:Date:List-ID:From; b=hG7ayCU/fEVQjwaMRntcu88ldDBZHTb+p+OyCGFBXaPjycp+4iIqlh0bJ+otyRMEd T2LpHzK6Fzx15RtJ19JKjRFF3hePaw8U3oalLkzaigX0XbfoWuFD9vT5PFE3Asq8Ag Lcc3mNtkaWtHUzbbAL0F1ThJbw0vQnH6XeiScWBc= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726686AbfCTTVL (ORCPT ); Wed, 20 Mar 2019 15:21:11 -0400 Received: from out5-smtp.messagingengine.com ([66.111.4.29]:50343 "EHLO out5-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726093AbfCTTVL (ORCPT ); Wed, 20 Mar 2019 15:21:11 -0400 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 70B9422D87; Wed, 20 Mar 2019 15:21:10 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Wed, 20 Mar 2019 15:21:10 -0400 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=fm2; bh=3ubwIm V4DKc3MqXhy+Qx3w79JbClTkUchoBkhUMLYi4=; b=u0t6P5O/9PYwweH5rUNGsL 4MO+bxscamwztD2ZuDA5+sn02AgxPpvFfTLzC6GBR6t71uzOLYD6MD+WGo+X1pPs HQJz9tN4+nsLALN+xoAHJKayskgaGmeJQZywzWuWXuwECjZ80svRbMNCODVj9i6q l5Mgwkz2kEA0NmbEUPl8T8mVlAAq2xHgiSsfpbYyhby5o0Ur54VLG4tfD7ZU4mng HtdfqO1shaS64d2nNnVjrzPKIXoO/wv5W6UPui9VkZTVfp9j7FRNRQAAL3Q55pA4 KWy9cE9E5d2tf6jpfiUddQ8+vnFj7amjJV6D90sbyTRabvyw5oVPsoiVj2xuv+Bw == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedutddrieeigdduvdefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefuvffhfffkgggtgfesthekredttd dtlfenucfhrhhomhepoehgrhgvghhkhheslhhinhhugihfohhunhgurghtihhonhdrohhr gheqnecukfhppeekfedrkeeirdekledruddtjeenucfrrghrrghmpehmrghilhhfrhhomh epghhrvghgsehkrhhorghhrdgtohhmnecuvehluhhsthgvrhfuihiivgeptd X-ME-Proxy: Received: from localhost (5356596b.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) by mail.messagingengine.com (Postfix) with ESMTPA id 885B210316; Wed, 20 Mar 2019 15:21:09 -0400 (EDT) Subject: FAILED: patch "[PATCH] btrfs: drop the lock on error in btrfs_dev_replace_cancel" failed to apply to 4.19-stable tree To: dan.carpenter@oracle.com, anand.jain@oracle.com, dsterba@suse.com Cc: From: Date: Wed, 20 Mar 2019 20:21:08 +0100 Message-ID: <15531096685894@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.19-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 669e859b5ea7c6f4fce0149d3907c64e550c294b Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Mon, 11 Feb 2019 21:32:10 +0300 Subject: [PATCH] btrfs: drop the lock on error in btrfs_dev_replace_cancel We should drop the lock on this error path. This has been found by a static tool. The lock needs to be released, it's there to protect access to the dev_replace members and is not supposed to be left locked. The value of state that's being switched would need to be artifically changed to an invalid value so the default: branch is taken. Fixes: d189dd70e255 ("btrfs: fix use-after-free due to race between replace start and cancel") CC: stable@vger.kernel.org # 5.0+ Reviewed-by: Anand Jain Signed-off-by: Dan Carpenter Reviewed-by: David Sterba Signed-off-by: David Sterba diff --git a/fs/btrfs/dev-replace.c b/fs/btrfs/dev-replace.c index 13863354ff9d..ee193c5222b2 100644 --- a/fs/btrfs/dev-replace.c +++ b/fs/btrfs/dev-replace.c @@ -862,6 +862,7 @@ int btrfs_dev_replace_cancel(struct btrfs_fs_info *fs_info) btrfs_destroy_dev_replace_tgtdev(tgt_device); break; default: + up_write(&dev_replace->rwsem); result = -EINVAL; }