From patchwork Thu Aug 20 09:19:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 265403 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=-9.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT 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 D910EC433E1 for ; Thu, 20 Aug 2020 12:44:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B5B7422B4E for ; Thu, 20 Aug 2020 12:44:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597927467; bh=+kIHDLQ6VjW0ccUQkRNIQolnSfnUt5jKKnYmxmGxmxs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=OGdQP6XfvzqrSOHiFzTx66Hrrq1IMGVY4qUvcWV2ph4gWSojQhiozBJFys0uFEtw6 HPXF5rj1jZIF5BI0IA5anLTycmay+IJSYlxWB0oITyuV7vC7bTdKVCr9FkpkNipLMl yGZ1fwKna4DVvj8hNW3YhsfFEXmtM85e2cqP/N/8= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729844AbgHTMoY (ORCPT ); Thu, 20 Aug 2020 08:44:24 -0400 Received: from mail.kernel.org ([198.145.29.99]:45700 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729311AbgHTJpp (ORCPT ); Thu, 20 Aug 2020 05:45:45 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A3BDA20724; Thu, 20 Aug 2020 09:45:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597916741; bh=+kIHDLQ6VjW0ccUQkRNIQolnSfnUt5jKKnYmxmGxmxs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=abqGIfqdjbVuA12K39TXsYSW96IIlJBllcNMtYWdauJjgRJuT5aAF6nUEVxHuLv4Q Q3fe7MAJZcYDUOVzGAR8rzHNdyU6qir761PPzdkr8qgSh72hrzHAr5ioheHQAXveIj uE4thZhQ3tVK3emJEzvQ3D60N09JWi1Jbpe0mnmI= 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 Subject: [PATCH 5.4 029/152] btrfs: fix return value mixup in btrfs_get_extent Date: Thu, 20 Aug 2020 11:19:56 +0200 Message-Id: <20200820091555.151988769@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200820091553.615456912@linuxfoundation.org> References: <20200820091553.615456912@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@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: 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 @@ -7194,7 +7194,7 @@ struct extent_map *btrfs_get_extent(stru extent_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));