Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9047619pxu; Mon, 28 Dec 2020 05:21:39 -0800 (PST) X-Google-Smtp-Source: ABdhPJxZSpBw+9V11CdYkeKcx03PQ/3bcK6cZbNM/i5vFntborAldFLOKfbUSP0Rxm3a9eK+Og3a X-Received: by 2002:a50:a6de:: with SMTP id f30mr43263583edc.30.1609161699474; Mon, 28 Dec 2020 05:21:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609161699; cv=none; d=google.com; s=arc-20160816; b=ZMYOHv9f4UBYBxn2cGJTuOFaKYY/iYOqFvCmlE26D4Fpl37fzcdc9afbRUCfyVllNt y4LwelN1uXtrGRO8CpWK+QgW9yKv6DejCe1jwBKocHOVsgGbSx8IrlVU0e4FjCaqBxYe EZoqrCj8uprt0wJ7XwAfgWzYPZqiNegBNXq10rDsOwMduan0woklXmLCZ5N3RKhx/3jP IWprm5g7zmsTnVh1+4r33HHDJUmGzq8S8qv2Yyh3zGpiscooF7myntsap7Jf7SAWzJga ZGOg7B/F/b2Eott6OflWP6oTEPNZPn/ER1bZFZXhJrXOy0+qG/McGwCAv5uVub5Y0L0G 5QUg== 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=i3tiCa+hBDvXZzNoEUn/KWvuf3oYSngVFptWri1mvII=; b=KD91vX9q5jGafOxeuhNsnsN4xPCoOtoTP+u2ygTp48p36/L075vP6Tb/bj6TaH4+Kk sb/d1QOkgRh9NHS4y6QnktrIAHVVCbgDeYX5ezV23TBspjNTkwhD3MrrQkMRNDo5f6uv Xm8F5CWhJ1CXbawXnL+N/tyB+uC0kCThRyS8xHJnClxCG5zR4Rrswbaq3hFNTGgCIq+3 tKQmR8APbjiSyTHGQNUpXiO6pBioF/WPC5LMiD9R5FBuw2MGQzFzWUmx5P1c82GeCgS0 gIrhrER9wyHStC4RQ9lNb+2uoAD56RBAsAisPQ603GCxztMTK/288Oy+28zUNIzMnbMm ZxDw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="h5JA/aEa"; 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 j13si18538750ejc.454.2020.12.28.05.21.14; Mon, 28 Dec 2020 05:21:39 -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="h5JA/aEa"; 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 S1732216AbgL1NSr (ORCPT + 99 others); Mon, 28 Dec 2020 08:18:47 -0500 Received: from mail.kernel.org ([198.145.29.99]:47042 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731803AbgL1NSo (ORCPT ); Mon, 28 Dec 2020 08:18:44 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id AD8112076D; Mon, 28 Dec 2020 13:18:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609161508; bh=P3raXtEBSIH6/xIGEVgeFVA6AX+u3JpnQit2IEx/KWg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=h5JA/aEa8ZnnygAZSuZKHtA9CHNT9urNoSSFnDsEZMhgUKh7B+YKf72wG1O70uxtg pr1qVrThrx3q7vB0707jg6zfiXbkZa+/ApKBzvU8OHCDxCUL3g5Wx7KEX+VxPrJ9WI bXzynk8tnMEYIWX1XFJD+uluklyjHmxSXQncGfWI= 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.14 207/242] btrfs: fix return value mixup in btrfs_get_extent Date: Mon, 28 Dec 2020 13:50:12 +0100 Message-Id: <20201228124914.864168544@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228124904.654293249@linuxfoundation.org> References: <20201228124904.654293249@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 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 @@ -7179,7 +7179,7 @@ again: found_type == BTRFS_FILE_EXTENT_PREALLOC) { /* Only regular file could have regular/prealloc extent */ if (!S_ISREG(inode->vfs_inode.i_mode)) { - ret = -EUCLEAN; + err = -EUCLEAN; btrfs_crit(fs_info, "regular/prealloc extent found for non-regular inode %llu", btrfs_ino(inode));