Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp355964pxk; Thu, 24 Sep 2020 07:17:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxEi0WQ+LH8REI05174wF65IbGtoBAWu15qJ9Ro1dmfzllRlzz5aTwm8gUWk+Bj8PGBWg05 X-Received: by 2002:a05:6402:1b9a:: with SMTP id cc26mr147478edb.30.1600957038372; Thu, 24 Sep 2020 07:17:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600957038; cv=none; d=google.com; s=arc-20160816; b=LlVpt9h/RIA+sUychH4k/GU1D5eWUPY4ELl3w5ilPMsl53Y0r+llPRXDF6hiwHvEpS I0/r8/SGZS2H7CRtJJtd22WGvIWFCeMUgtAFDqaqj4Ij5t1S349tIwTpmhQeTcVK4pBu /Ps5ytrGmzscFUscIqA7MRtMBmds4QtX+5uixBWTbo9MPiC/msfbmz8RP/pevuoSngKt PxJjKcUKr/FPjdn/TVqOWC5nwkbYn99Dm4VPOr6n+sJk82s2EtMqld+YFV6zupIlhFhg KtzI/tzoA3ySnYh1yr5Fx51+ESoTua5qY6v4YItUfwncsxNHkqHQj7+7Zyd8MWgaO1Sp oO9g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:mail-followup-to:reply-to:message-id :subject:cc:to:from:date; bh=m5lZgPsw5W6XZYI9TY0Q6U/F7Apdl4cHoDAmuNOOZA0=; b=j7iYzVUlmbj7vZchLB51zyj3bKwAXVGLKecJ/1lwbvwKjJiY44oAcXABTmjfq5WALE ry8vowVYuQZoimDqFgf8CBMLeT+1vzZ+NwK9wISj9zRajq0xg6iMpLwHC/tp74BGkI3s 2t/EoSPU7DhywRz9ecNGOR7DShHaNOACiomf5qBvwRF50Nz2DtFpNd/CdVzbtoe5rvQr pUzXX1mX1wg9RvJA+1qWPql/AQDRQBdE8rgM6O8CBT0JD695oxkZ20M84AhJuTTEXGDn gr91mhLt2InhdzzooEuMo3EV7p/SnJWfsQ2K3X/747pWVMlhSYkG6WG3FDVpKgt96gLR 52hg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m3si2052527ejk.485.2020.09.24.07.16.23; Thu, 24 Sep 2020 07:17:18 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728162AbgIXOMj (ORCPT + 99 others); Thu, 24 Sep 2020 10:12:39 -0400 Received: from mx2.suse.de ([195.135.220.15]:59408 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727982AbgIXOMi (ORCPT ); Thu, 24 Sep 2020 10:12:38 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 289E1AC4C; Thu, 24 Sep 2020 14:12:37 +0000 (UTC) Received: by ds.suse.cz (Postfix, from userid 10065) id BCF61DA6E3; Thu, 24 Sep 2020 16:11:20 +0200 (CEST) Date: Thu, 24 Sep 2020 16:11:20 +0200 From: David Sterba To: linux-btrfs@vger.kernel.org Cc: Chris Mason , Josef Bacik , David Sterba , linux-kernel@vger.kernel.org Subject: Re: [PATCH] btrfs: Fix potential null pointer deref Message-ID: <20200924141120.GX6756@twin.jikos.cz> Reply-To: dsterba@suse.cz Mail-Followup-To: dsterba@suse.cz, linux-btrfs@vger.kernel.org, Chris Mason , Josef Bacik , David Sterba , linux-kernel@vger.kernel.org References: <20200921191243.27833-1-a.dewar@sussex.ac.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200921191243.27833-1-a.dewar@sussex.ac.uk> User-Agent: Mutt/1.5.23.1-rc1 (2014-03-12) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Sep 21, 2020 at 08:12:44PM +0100, Alex Dewar wrote: > In btrfs_destroy_inode(), the variable root may be NULL, but the check > for this takes place after its value has already been dereferenced to > access its fs_info member. Move the dereference operation to later in > the function. > > Fixes: a6dbd429d8dd ("Btrfs: fix panic when trying to destroy a newly allocated") > Addresses-Coverity: CID 1497103: Null pointer dereferences (REVERSE_INULL) > Signed-off-by: Alex Dewar For some reason my replies did not get to linux-btrfs@, so for the record the changes has been folded to the patch "btrfs: clean BTRFS_I usage in btrfs_destroy_inode".