[PATCH] nvme: check for valid data from from nvme_identify_ns() before using it
Keith Busch
kbusch at kernel.org
Tue Nov 21 10:13:47 PST 2023
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.
> > > @@ -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.
More information about the Linux-nvme
mailing list