From: Ira Weiny <ira.weiny@intel.com>
To: Yi Yang <yiyang13@huawei.com>, <dan.j.williams@intel.com>,
<vishal.l.verma@intel.com>, <dave.jiang@intel.com>,
<ira.weiny@intel.com>
Cc: <nvdimm@lists.linux.dev>, <wangweiyang2@huawei.com>
Subject: Re: [PATCH] nvdimm: fix possible null-ptr-deref in nd_dax_probe()
Date: Mon, 28 Oct 2024 09:17:18 -0500 [thread overview]
Message-ID: <671f9cee9a07f_23f01e2949f@iweiny-mobl.notmuch> (raw)
In-Reply-To: <20241026010622.2641355-1-yiyang13@huawei.com>
Yi Yang wrote:
> It will cause null-ptr-deref when nd_dax_alloc() returns NULL, fix it by
> add check for nd_dax_alloc().
Was this found with a real workload or just by inspection?
Ira
>
> Fixes: c5ed9268643c ("libnvdimm, dax: autodetect support")
> Signed-off-by: Yi Yang <yiyang13@huawei.com>
> ---
> drivers/nvdimm/dax_devs.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/drivers/nvdimm/dax_devs.c b/drivers/nvdimm/dax_devs.c
> index 6b4922de3047..70a7e401f90d 100644
> --- a/drivers/nvdimm/dax_devs.c
> +++ b/drivers/nvdimm/dax_devs.c
> @@ -106,6 +106,10 @@ int nd_dax_probe(struct device *dev, struct nd_namespace_common *ndns)
>
> nvdimm_bus_lock(&ndns->dev);
> nd_dax = nd_dax_alloc(nd_region);
> + if (!nd_dax) {
> + nvdimm_bus_unlock(&ndns->dev);
> + return -ENOMEM;
> + }
> nd_pfn = &nd_dax->nd_pfn;
> dax_dev = nd_pfn_devinit(nd_pfn, ndns);
> nvdimm_bus_unlock(&ndns->dev);
> --
> 2.25.1
>
>
next prev parent reply other threads:[~2024-10-28 14:17 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-26 1:06 [PATCH] nvdimm: fix possible null-ptr-deref in nd_dax_probe() Yi Yang
2024-10-28 14:17 ` Ira Weiny [this message]
2024-10-29 2:10 ` yiyang (D)
2024-10-28 16:26 ` Dan Williams
2024-10-29 1:57 ` yiyang (D)
2024-11-08 8:55 ` [PATCH] nvdimm: rectify the illogical code within nd_dax_probe() Yi Yang
2024-11-13 17:08 ` Dave Jiang
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=671f9cee9a07f_23f01e2949f@iweiny-mobl.notmuch \
--to=ira.weiny@intel.com \
--cc=dan.j.williams@intel.com \
--cc=dave.jiang@intel.com \
--cc=nvdimm@lists.linux.dev \
--cc=vishal.l.verma@intel.com \
--cc=wangweiyang2@huawei.com \
--cc=yiyang13@huawei.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