linux-nvdimm.lists.01.org archive mirror
 help / color / mirror / Atom feed
From: Dan Williams <dan.j.williams@intel.com>
To: Mike Snitzer <snitzer@redhat.com>
Cc: linux-fsdevel <linux-fsdevel@vger.kernel.org>,
	device-mapper development <dm-devel@redhat.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Alasdair Kergon <agk@redhat.com>,
	linux-nvdimm <linux-nvdimm@lists.01.org>
Subject: Re: dm: fix dax_dev NULL dereference
Date: Tue, 30 Jul 2019 15:15:30 -0700	[thread overview]
Message-ID: <CAA9_cmd8to1108H+osSuyyRriX50-g1YV3YebJ=PNsKbW0NPFw@mail.gmail.com> (raw)
In-Reply-To: <20190730220102.GA15604@redhat.com>

On Tue, Jul 30, 2019 at 3:01 PM Mike Snitzer <snitzer@redhat.com> wrote:
>
> On Tue, Jul 30 2019 at  5:38pm -0400,
> Dan Williams <dan.j.williams@intel.com> wrote:
>
> > On Tue, Jul 30, 2019 at 12:07 PM Mike Snitzer <snitzer@redhat.com> wrote:
> > >
> > > I staged the fix (which I tweaked) here:
> > > https://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm.git/commit/?h=dm-5.3&id=95b9ebb78c4c733f8912a195fbd0bc19960e726e
> >
> > Thanks for picking this up Mike, but I'd prefer to just teach
> > dax_synchronous() to return false if the passed in dax_dev is NULL.
> > Thoughts?
>
> I considered that too but I moved away from it because I'm so used to
> the various block interfaces requiring the caller pass a non-NULL
> pointer (e.g. request_queue):
>
> $ grep -ri return drivers/md/dm-table.c | grep \&\&
> drivers/md/dm-table.c:        return dev->dax_dev && dax_synchronous(dev->dax_dev);
> drivers/md/dm-table.c:        return q && blk_queue_zoned_model(q) == *zoned_model;
> drivers/md/dm-table.c:        return q && blk_queue_zone_sectors(q) == *zone_sectors;
> drivers/md/dm-table.c:        return q && (q->queue_flags & flush);
> drivers/md/dm-table.c:        return q && blk_queue_nonrot(q);
> drivers/md/dm-table.c:        return q && !blk_queue_add_random(q);
> drivers/md/dm-table.c:        return q && !q->limits.max_write_same_sectors;
> drivers/md/dm-table.c:        return q && !q->limits.max_write_zeroes_sectors;
> drivers/md/dm-table.c:        return q && !blk_queue_discard(q);
> drivers/md/dm-table.c:        return q && !blk_queue_secure_erase(q);
> drivers/md/dm-table.c:        return q && bdi_cap_stable_pages_required(q->backing_dev_info);
>
> I'm fine with however you'd like to skin this cat though.
>
> Just let me know and I'll keep/drop this patch accordingly.

Ok, since you've already got it queued, and there are no other
required "if (!dax_dev)" fixups go ahead with what you have.

    Acked-by: Dan Williams <dan.j.williams@intel.com>

I just reserve the right to go push it down a level if the kernel ever
grows more dax_synchronous() users that do that safety check.
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

  reply	other threads:[~2019-07-30 22:18 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-30 11:37 [PATCH] dm: fix dax_dev NULL dereference Pankaj Gupta
2019-07-30 11:38 ` Pankaj Gupta
2019-07-30 19:07   ` Mike Snitzer
2019-07-30 21:38     ` Dan Williams
2019-07-30 22:01       ` Mike Snitzer
2019-07-30 22:15         ` Dan Williams [this message]
2019-07-31  3:50     ` Pankaj Gupta

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='CAA9_cmd8to1108H+osSuyyRriX50-g1YV3YebJ=PNsKbW0NPFw@mail.gmail.com' \
    --to=dan.j.williams@intel.com \
    --cc=agk@redhat.com \
    --cc=dm-devel@redhat.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nvdimm@lists.01.org \
    --cc=snitzer@redhat.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;
as well as URLs for NNTP newsgroup(s).