All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] acpi, nfit: fix health event notification
@ 2017-12-01  1:55 ` Dan Williams
  0 siblings, 0 replies; 4+ messages in thread
From: Dan Williams @ 2017-12-01  1:55 UTC (permalink / raw)
  To: linux-nvdimm; +Cc: Daniel Osawa, stable, linux-acpi

Integration testing with a BIOS that generates injected health event
notifications fails to communicate those events to userspace. The nfit
driver neglects to link the ACPI DIMM device with the necessary driver
data so acpi_nvdimm_notify() fails this lookup:

        nfit_mem = dev_get_drvdata(dev);
        if (nfit_mem && nfit_mem->flags_attr)
                sysfs_notify_dirent(nfit_mem->flags_attr);

Add the necessary linkage when installing the notification handler and
clean it up when the nfit driver instance is torn down.

Cc: <stable@vger.kernel.org>
Cc: Toshi Kani <toshi.kani@hpe.com>
Cc: Vishal Verma <vishal.l.verma@intel.com>
Fixes: ba9c8dd3c222 ("acpi, nfit: add dimm device notification support")
Reported-by: Daniel Osawa <daniel.k.osawa@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 drivers/acpi/nfit/core.c |    6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/acpi/nfit/core.c b/drivers/acpi/nfit/core.c
index ff2580e7611d..947ea8a92761 100644
--- a/drivers/acpi/nfit/core.c
+++ b/drivers/acpi/nfit/core.c
@@ -1670,6 +1670,11 @@ static int acpi_nfit_add_dimm(struct acpi_nfit_desc *acpi_desc,
 				dev_name(&adev_dimm->dev));
 		return -ENXIO;
 	}
+	/*
+	 * Record nfit_mem for the notification path to track back to
+	 * the nfit sysfs attributes for this dimm device object.
+	 */
+	dev_set_drvdata(&adev_dimm->dev, nfit_mem);
 
 	/*
 	 * Until standardization materializes we need to consider 4
@@ -1755,6 +1760,7 @@ static void shutdown_dimm_notify(void *data)
 		if (adev_dimm)
 			acpi_remove_notify_handler(adev_dimm->handle,
 					ACPI_DEVICE_NOTIFY, acpi_nvdimm_notify);
+		dev_set_drvdata(&adev_dimm->dev, NULL);
 	}
 	mutex_unlock(&acpi_desc->init_mutex);
 }

_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH] acpi, nfit: fix health event notification
@ 2017-12-01  1:55 ` Dan Williams
  0 siblings, 0 replies; 4+ messages in thread
From: Dan Williams @ 2017-12-01  1:55 UTC (permalink / raw)
  To: linux-nvdimm; +Cc: Vishal Verma, Daniel Osawa, stable, Toshi Kani, linux-acpi

Integration testing with a BIOS that generates injected health event
notifications fails to communicate those events to userspace. The nfit
driver neglects to link the ACPI DIMM device with the necessary driver
data so acpi_nvdimm_notify() fails this lookup:

        nfit_mem = dev_get_drvdata(dev);
        if (nfit_mem && nfit_mem->flags_attr)
                sysfs_notify_dirent(nfit_mem->flags_attr);

Add the necessary linkage when installing the notification handler and
clean it up when the nfit driver instance is torn down.

Cc: <stable@vger.kernel.org>
Cc: Toshi Kani <toshi.kani@hpe.com>
Cc: Vishal Verma <vishal.l.verma@intel.com>
Fixes: ba9c8dd3c222 ("acpi, nfit: add dimm device notification support")
Reported-by: Daniel Osawa <daniel.k.osawa@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 drivers/acpi/nfit/core.c |    6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/acpi/nfit/core.c b/drivers/acpi/nfit/core.c
index ff2580e7611d..947ea8a92761 100644
--- a/drivers/acpi/nfit/core.c
+++ b/drivers/acpi/nfit/core.c
@@ -1670,6 +1670,11 @@ static int acpi_nfit_add_dimm(struct acpi_nfit_desc *acpi_desc,
 				dev_name(&adev_dimm->dev));
 		return -ENXIO;
 	}
+	/*
+	 * Record nfit_mem for the notification path to track back to
+	 * the nfit sysfs attributes for this dimm device object.
+	 */
+	dev_set_drvdata(&adev_dimm->dev, nfit_mem);
 
 	/*
 	 * Until standardization materializes we need to consider 4
@@ -1755,6 +1760,7 @@ static void shutdown_dimm_notify(void *data)
 		if (adev_dimm)
 			acpi_remove_notify_handler(adev_dimm->handle,
 					ACPI_DEVICE_NOTIFY, acpi_nvdimm_notify);
+		dev_set_drvdata(&adev_dimm->dev, NULL);
 	}
 	mutex_unlock(&acpi_desc->init_mutex);
 }


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] acpi, nfit: fix health event notification
  2017-12-01  1:55 ` Dan Williams
@ 2017-12-08 23:51   ` Kani, Toshimitsu
  -1 siblings, 0 replies; 4+ messages in thread
From: Kani, Toshimitsu @ 2017-12-08 23:51 UTC (permalink / raw)
  To: dan.j.williams, linux-nvdimm; +Cc: linux-acpi, daniel.k.osawa, stable

On Thu, 2017-11-30 at 17:55 -0800, Dan Williams wrote:
> Integration testing with a BIOS that generates injected health event
> notifications fails to communicate those events to userspace. The nfit
> driver neglects to link the ACPI DIMM device with the necessary driver
> data so acpi_nvdimm_notify() fails this lookup:
> 
>         nfit_mem = dev_get_drvdata(dev);
>         if (nfit_mem && nfit_mem->flags_attr)
>                 sysfs_notify_dirent(nfit_mem->flags_attr);
> 
> Add the necessary linkage when installing the notification handler and
> clean it up when the nfit driver instance is torn down.
> 
> Cc: <stable@vger.kernel.org>
> Cc: Toshi Kani <toshi.kani@hpe.com>
> Cc: Vishal Verma <vishal.l.verma@intel.com>
> Fixes: ba9c8dd3c222 ("acpi, nfit: add dimm device notification support")
> Reported-by: Daniel Osawa <daniel.k.osawa@intel.com>
> Signed-off-by: Dan Williams <dan.j.williams@intel.com>

The fix looks good.  Sorry it appears that I only tested ACPI
notification, not sysfs event, for the original change.

Reviewed-by: Toshi Kani <toshi.kani@hpe.com>

Thanks!
-Toshi
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] acpi, nfit: fix health event notification
@ 2017-12-08 23:51   ` Kani, Toshimitsu
  0 siblings, 0 replies; 4+ messages in thread
From: Kani, Toshimitsu @ 2017-12-08 23:51 UTC (permalink / raw)
  To: dan.j.williams, linux-nvdimm
  Cc: daniel.k.osawa, stable, linux-acpi, vishal.l.verma

On Thu, 2017-11-30 at 17:55 -0800, Dan Williams wrote:
> Integration testing with a BIOS that generates injected health event
> notifications fails to communicate those events to userspace. The nfit
> driver neglects to link the ACPI DIMM device with the necessary driver
> data so acpi_nvdimm_notify() fails this lookup:
> 
>         nfit_mem = dev_get_drvdata(dev);
>         if (nfit_mem && nfit_mem->flags_attr)
>                 sysfs_notify_dirent(nfit_mem->flags_attr);
> 
> Add the necessary linkage when installing the notification handler and
> clean it up when the nfit driver instance is torn down.
> 
> Cc: <stable@vger.kernel.org>
> Cc: Toshi Kani <toshi.kani@hpe.com>
> Cc: Vishal Verma <vishal.l.verma@intel.com>
> Fixes: ba9c8dd3c222 ("acpi, nfit: add dimm device notification support")
> Reported-by: Daniel Osawa <daniel.k.osawa@intel.com>
> Signed-off-by: Dan Williams <dan.j.williams@intel.com>

The fix looks good.  Sorry it appears that I only tested ACPI
notification, not sysfs event, for the original change.

Reviewed-by: Toshi Kani <toshi.kani@hpe.com>

Thanks!
-Toshi

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-12-08 23:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-01  1:55 [PATCH] acpi, nfit: fix health event notification Dan Williams
2017-12-01  1:55 ` Dan Williams
2017-12-08 23:51 ` Kani, Toshimitsu
2017-12-08 23:51   ` Kani, Toshimitsu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.