[PATCH] nvme: check for valid data from from nvme_identify_ns() before using it

Ewan Milne emilne at redhat.com
Mon Nov 27 12:53:32 PST 2023


On Tue, Nov 21, 2023 at 1:14 PM Keith Busch <kbusch at kernel.org> wrote:
>
> On Tue, Nov 21, 2023 at 06:49:35AM -0500, Ewan Milne wrote:
> > Oh, never mind, I see it.  Just didn't see anything on the list.  Sorry.
>
> Is it? I don't see it in any of the staging or upstream trees, but thank
> you for pinging me on the patch.

Sorry, I wasn't clear.  I hadn't seen any replies to my original patch
on the list, but
I saw a rather long time of receiving nothing from linux-nvme, so I wasn't sure
if my original mail went anywhere.  But I found it on the archive.

>
> > > > @@ -2027,6 +2027,12 @@ static int nvme_update_ns_info_block(struct nvme_ns *ns,
> > > >         if (ret)
> > > >                 return ret;
> > > >
> > > > +       if (id->ncap == 0) {
> > > > +               /* namespace not allocated or attached */
> > > > +               info->is_removed = true;
> > > > +               return -ENODEV;
>
> The concept sounds good, though you are leaking 'id' in the new error case.
>

I will send a v2 to correct this, Maurizio has fixed the other caller.

-Ewan




More information about the Linux-nvme mailing list