public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: Steve Magnani <steve.magnani@digidescorp.com>
Cc: Jan Kara <jack@suse.cz>, Colin King <colin.king@canonical.com>,
	Jan Kara <jack@suse.com>,
	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
Date: Wed, 20 Feb 2019 10:50:15 +0100	[thread overview]
Message-ID: <20190220095015.GB27474@quack2.suse.cz> (raw)
In-Reply-To: <aef899da-4dc1-1e40-30c9-fc2ca87f2380@digidescorp.com>

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 <colin.king@canonical.com>
> > > 
> > > 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 <colin.king@canonical.com>
> > 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 <steve@digidescorp.com>

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 <jack@suse.com>
SUSE Labs, CR

  reply	other threads:[~2019-02-20  9:50 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-19 11:44 [PATCH][udf-next] udf: don't call mark_buffer_dirty on a null bh pointer Colin King
2019-02-19 14:02 ` Jan Kara
2019-02-19 14:17   ` Steve Magnani
2019-02-20  9:50     ` Jan Kara [this message]
2019-02-20 11:27       ` Steve Magnani

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190220095015.GB27474@quack2.suse.cz \
    --to=jack@suse.cz \
    --cc=colin.king@canonical.com \
    --cc=jack@suse.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=steve.magnani@digidescorp.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox