LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Ira Weiny <ira.weiny@intel.com>
To: Vaibhav Jain <vaibhav@linux.ibm.com>
Cc: linux-nvdimm@lists.01.org,
	"Aneesh Kumar K . V" <aneesh.kumar@linux.ibm.com>,
	Sandipan Das <sandipan@linux.ibm.com>,
	Dan Williams <dan.j.williams@intel.com>,
	linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH] libnvdimm: Add a NULL entry to 'nvdimm_firmware_attributes'
Date: Fri, 14 Aug 2020 10:10:06 -0700	[thread overview]
Message-ID: <20200814171005.GB3142014@iweiny-DESK2.sc.intel.com> (raw)
In-Reply-To: <20200814150509.225615-1-vaibhav@linux.ibm.com>

On Fri, Aug 14, 2020 at 08:35:09PM +0530, Vaibhav Jain wrote:
> We recently discovered a kernel oops with 'papr_scm' module while
> booting ppc64 phyp guest with following back-trace:
> 
> BUG: Kernel NULL pointer dereference on write at 0x00000188
> Faulting instruction address: 0xc0000000005d7084
> Oops: Kernel access of bad area, sig: 11 [#1]
> <snip>
> Call Trace:
>  internal_create_group+0x128/0x4c0 (unreliable)
>  internal_create_groups.part.4+0x70/0x130
>  device_add+0x458/0x9c0
>  nd_async_device_register+0x28/0xa0 [libnvdimm]
>  async_run_entry_fn+0x78/0x1f0
>  process_one_work+0x2c0/0x5b0
>  worker_thread+0x88/0x650
>  kthread+0x1a8/0x1b0
>  ret_from_kernel_thread+0x5c/0x6c
> 
> A bisect lead to the 'commit 48001ea50d17f ("PM, libnvdimm: Add runtime
> firmware activation support")' and on investigation discovered that
> the newly introduced 'struct attribute *nvdimm_firmware_attributes[]'
> is missing a terminating NULL entry in the array. This causes a loop
> in sysfs's 'create_files()' to read garbage beyond bounds of
> 'nvdimm_firmware_attributes' and trigger the oops.
> 
> Fixes: 48001ea50d17f ("PM, libnvdimm: Add runtime firmware activation support")
> Reported-by: Sandipan Das <sandipan@linux.ibm.com>
> Signed-off-by: Vaibhav Jain <vaibhav@linux.ibm.com>

Reviewed-by: Ira Weiny <ira.weiny@intel.com>

> ---
>  drivers/nvdimm/dimm_devs.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/nvdimm/dimm_devs.c b/drivers/nvdimm/dimm_devs.c
> index 61374def51555..b59032e0859b7 100644
> --- a/drivers/nvdimm/dimm_devs.c
> +++ b/drivers/nvdimm/dimm_devs.c
> @@ -529,6 +529,7 @@ static DEVICE_ATTR_ADMIN_RW(activate);
>  static struct attribute *nvdimm_firmware_attributes[] = {
>  	&dev_attr_activate.attr,
>  	&dev_attr_result.attr,
> +	NULL,
>  };
>  
>  static umode_t nvdimm_firmware_visible(struct kobject *kobj, struct attribute *a, int n)
> -- 
> 2.26.2
> 

  reply	other threads:[~2020-08-14 17:12 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-14 15:05 [PATCH] libnvdimm: Add a NULL entry to 'nvdimm_firmware_attributes' Vaibhav Jain
2020-08-14 17:10 ` Ira Weiny [this message]
2020-08-14 22:55   ` Verma, Vishal L

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=20200814171005.GB3142014@iweiny-DESK2.sc.intel.com \
    --to=ira.weiny@intel.com \
    --cc=aneesh.kumar@linux.ibm.com \
    --cc=dan.j.williams@intel.com \
    --cc=linux-nvdimm@lists.01.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=sandipan@linux.ibm.com \
    --cc=vaibhav@linux.ibm.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