Received: by 2002:ac0:a679:0:0:0:0:0 with SMTP id p54csp381182imp; Wed, 20 Feb 2019 01:52:43 -0800 (PST) X-Google-Smtp-Source: AHgI3IZuwbkUG1a6+L587548ch75MA5QuOkmcl7/BCBjcC2Y84A0QAOhUTHC7HJ83Lp/gX5c+GmE X-Received: by 2002:a63:4f58:: with SMTP id p24mr14250104pgl.283.1550656363150; Wed, 20 Feb 2019 01:52:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550656363; cv=none; d=google.com; s=arc-20160816; b=bvR6F/w0+Tcpi9s6aVOxaoy0nvYd//V6lxknvp1kyT2ys8pziu+ALuOwu8veDJ4+tM 1ENVl8RespLMqPxAR2r8BKHHzcHqJCW6DI1h8RyYqroo6kM//BeGYnnwilurnc7DZ68/ 727HqUh+1sVmMENZqfCQvKBzNgD92NAnENNRjCWNf5ZPYUqhTKNF+Ce6hu8yPf4bwVfh gSXDXvoTqlKeu5s7vQUVYtg/COPKkzq/FjtzbxXEARmJkU7BWP4R/WBc+i/9/DD88PxQ +o2coe7qNTsF2VWC9b00/54yF+cfNvC0wZMG+MK5bMmMeQpS3Xgz/77DN+bEpk9sF5Yb DPEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=84syiYPEbdVBoqwVib36qiJvsfduR9efFykg+OJEY+c=; b=PBTKEGZH+hCKzyopAjhAjN+iDVoQZOsKEV39YPCGny6tkYaAHtTpAj+3+Cm039uE+H 5VwdPieLjcX8iRFiEcYRQANTy41bP1vnZq/Yhd0Kp2fCrybQNtgBzW1ZoYrCYY/ebFAE seXsj0SGUb7T8sQ6pCTAxWYwBF3tyquZT2rLcxcCFMPjGt/+dGCapjjV/x+CziDGsXVC DF3OHRYEinyqUiXUFPcUeS1m4aO+4d7Je8DPNNXJW7HrI49FvdOScq1wx3VqgIG7MoQj 5M3hLgrEZc0nDKhXeQxMpGMrdiYaynH/WSuG+IsdbsSAxynEvb3E1JGuK4JvNXJ1SqM9 68Lg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e92si19603595plb.152.2019.02.20.01.52.27; Wed, 20 Feb 2019 01:52:43 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727216AbfBTJuR (ORCPT + 99 others); Wed, 20 Feb 2019 04:50:17 -0500 Received: from mx2.suse.de ([195.135.220.15]:43124 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726142AbfBTJuQ (ORCPT ); Wed, 20 Feb 2019 04:50:16 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 7F01AB179; Wed, 20 Feb 2019 09:50:15 +0000 (UTC) Received: by quack2.suse.cz (Postfix, from userid 1000) id 1C9BC1E0880; Wed, 20 Feb 2019 10:50:15 +0100 (CET) Date: Wed, 20 Feb 2019 10:50:15 +0100 From: Jan Kara To: Steve Magnani Cc: Jan Kara , Colin King , Jan Kara , kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH][udf-next] udf: don't call mark_buffer_dirty on a null bh pointer Message-ID: <20190220095015.GB27474@quack2.suse.cz> References: <20190219114403.24771-1-colin.king@canonical.com> <20190219140240.GA31849@quack2.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue 19-02-19 08:17:09, Steve Magnani wrote: > On 2/19/19 8:02 AM, Jan Kara wrote: > > On Tue 19-02-19 11:44:03, Colin King wrote: > > > From: Colin Ian King > > > > > > There is a null check on the pointer bh to avoid a null pointer dereference > > > on bh->b_data however later bh is passed to mark_buffer_dirty that can also > > > cause a null pointer dereference on bh. Avoid this potential null pointer > > > dereference by moving the call to mark_buffer_dirty inside the null checked > > > block. > > > > > > Fixes: e8b4274735e4 ("udf: finalize integrity descriptor before writeback") > > > Signed-off-by: Colin Ian King > > Thanks for the patch! In fact it is the 'if (bh)' check that's > > unnecessarily defensive (we cannot have sbi->s_lvid_dirty and > > !sbi->s_lvid_bh). So I'll just drop that check (attached patch). > > > > Honza > > > > > --- > > > fs/udf/super.c | 12 ++++++------ > > > 1 file changed, 6 insertions(+), 6 deletions(-) > > > > > > diff --git a/fs/udf/super.c b/fs/udf/super.c > > > index a6940d90bedd..b7e9a83d39db 100644 > > > --- a/fs/udf/super.c > > > +++ b/fs/udf/super.c > > > @@ -2336,13 +2336,13 @@ static int udf_sync_fs(struct super_block *sb, int wait) > > > lvid = (struct logicalVolIntegrityDesc *)bh->b_data; > > > udf_finalize_lvid(lvid); > > > - } > > > - /* > > > - * Blockdevice will be synced later so we don't have to submit > > > - * the buffer for IO > > > - */ > > > - mark_buffer_dirty(bh); > > > + /* > > > + * Blockdevice will be synced later so we don't have > > > + * to submit the buffer for IO > > > + */ > > > + mark_buffer_dirty(bh); > > > + } > > > sbi->s_lvid_dirty = 0; > > > } > > > mutex_unlock(&sbi->s_alloc_mutex); > > > -- > > > 2.20.1 > > > > Reviewed-by: Steven J. Magnani Is this Reviewed-by for my fixup or the Colin's? Because I've decided to rather remove the 'if (bh)' check completely since it is pointless... Honza -- Jan Kara SUSE Labs, CR