Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9178075pxu; Mon, 28 Dec 2020 08:31:14 -0800 (PST) X-Google-Smtp-Source: ABdhPJzWTUyuzz8XVRrPtABM5CwIy7g4mv0WFDWliVb5kjWmTEAk663vxrFP1Ry+ybKLbXklSUAo X-Received: by 2002:a17:906:fb0e:: with SMTP id lz14mr43345269ejb.232.1609173073748; Mon, 28 Dec 2020 08:31:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609173073; cv=none; d=google.com; s=arc-20160816; b=CeLDsxg7wjlf/FNElJWZeKbw/aDy+4LFeDqBzKNFvPtffrLLCIk2cDCB3X2YT4VupC 1UNl9g06nCcM1FsP0rOCCHD7JAr0+5f2d9ErgmyZzt2HEfZ8CBdyMmBKRxlM+BZiVVjB DR+ZYE+qLkESc22yO5ZU6XKGhR2M/5fCdvlkHBRZXF1U3lf1JnwyoVcSvkfO1Cf7ymhL 71b68Uz6am6+7W5geuiTTrt9eomc11FFxA8ckvfuqixtfkDHaCfwKhqqDPda196pnmUB BOjQW2TMNDp82w3nmW04n5KgeDTKLudtcCO3eRNH72rVKXIAVEG2cI+NzR5DF/WnioTx ddkg== 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=pZ3NxY2+Ld0ON3dpVhDRjRmd3OpoQdx6UxyiDBZkw7c=; b=iArAZgMpVYzqonroZ6kJ7yGpf2zshMkqsacLSO+xHyDFmhQfZBLcDYhR/NV6OTU9lz AtQYkioZxhxoWiVxh0KNduVFZT8516Osi0doXCdJk4q5D7tEaDRf4fl8vpvVMXsXAaEn toO+VYNAmSYtBY0jGOiySGEcqDQVulNlzecMY+IhyvfSSp7Ou9AvRSYQ/oKMnLSwf9SH zQSi2y2x/zYUKnQeTplQXp2Pf4TxErn+ML13aoW1938x3dVeiHJ2XAp7sOEFl96afr+C GDoY4n5Ab9lnJG74rRCt1ZjKK/qSci3T3f9kZ9JmJTmY/Iw7slbqPo8IgsOagffMwTgt g5/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=AE5+uLLc; 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 u32si20698222edc.94.2020.12.28.08.30.50; Mon, 28 Dec 2020 08:31:13 -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=AE5+uLLc; 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 S1729596AbgL1NH7 (ORCPT + 99 others); Mon, 28 Dec 2020 08:07:59 -0500 Received: from mail.kernel.org ([198.145.29.99]:35040 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730776AbgL1NHZ (ORCPT ); Mon, 28 Dec 2020 08:07:25 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 3492B208D5; Mon, 28 Dec 2020 13:06:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609160804; bh=/i6sFlmN61X0wPI49xuMfIOqhc5hoE42yAtMu2XvkTg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AE5+uLLcewRIwpNqoLDYW+ErTd8WMEdN64+tIHc0xICo1yZgSFdfJ+HOkjttJfcxT 3sVw/aVjwbApjS+v6xbfB9xWRs2jVJB3yf3o6ofryy4VQF/ErsyiPOxCTTLvxKVZDq GYhPR9iiYnEiozNzhmJU5MkNoZAAgXC9ls4Y8/ic= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nikolay Borisov , "Pavel Machek (CIP)" , David Sterba , Sudip Mukherjee Subject: [PATCH 4.9 154/175] btrfs: fix return value mixup in btrfs_get_extent Date: Mon, 28 Dec 2020 13:50:07 +0100 Message-Id: <20201228124900.718807653@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228124853.216621466@linuxfoundation.org> References: <20201228124853.216621466@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: Pavel Machek commit 881a3a11c2b858fe9b69ef79ac5ee9978a266dc9 upstream btrfs_get_extent() sets variable ret, but out: error path expect error to be in variable err so the error code is lost. Fixes: 6bf9e4bd6a27 ("btrfs: inode: Verify inode mode to avoid NULL pointer dereference") CC: stable@vger.kernel.org # 5.4+ Reviewed-by: Nikolay Borisov Signed-off-by: Pavel Machek (CIP) Reviewed-by: David Sterba Signed-off-by: David Sterba [sudip: adjust context] Signed-off-by: Sudip Mukherjee Signed-off-by: Greg Kroah-Hartman --- fs/btrfs/inode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -7000,7 +7000,7 @@ again: found_type == BTRFS_FILE_EXTENT_PREALLOC) { /* Only regular file could have regular/prealloc extent */ if (!S_ISREG(inode->i_mode)) { - ret = -EUCLEAN; + err = -EUCLEAN; btrfs_crit(root->fs_info, "regular/prealloc extent found for non-regular inode %llu", btrfs_ino(inode));