diff mbox

[4.4,4.7,stable] acpi, nfit: check for the correct event code in notifications

Message ID 1477346286-27012-1-git-send-email-vishal.l.verma@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Verma, Vishal L Oct. 24, 2016, 9:58 p.m. UTC
commit c09f12186d6b03b798832d95289af76495990192 upstream.

Commit 209851649dc4 "acpi: nfit: Add support for hot-add" added
support for _FIT notifications, but it neglected to verify the
notification event code matches the one in the ACPI spec for
"NFIT Update". Currently there is only one code in the spec, but
once additional codes are added, older kernels (without this fix)
will misbehave by assuming all event notifications are for an
NFIT Update.

Fixes: 209851649dc4 ("acpi: nfit: Add support for hot-add")
Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
---

Note that the patch doesn't directly apply to stable-4.4, but using
'git am -3' works. Is this sufficient, or should I send a sepatate
patch for 4.4?

 drivers/acpi/nfit.c | 3 +++
 drivers/acpi/nfit.h | 4 ++++
 2 files changed, 7 insertions(+)

Comments

Greg KH Oct. 26, 2016, 9:23 a.m. UTC | #1
On Mon, Oct 24, 2016 at 03:58:06PM -0600, Vishal Verma wrote:
> commit c09f12186d6b03b798832d95289af76495990192 upstream.
> 
> Commit 209851649dc4 "acpi: nfit: Add support for hot-add" added
> support for _FIT notifications, but it neglected to verify the
> notification event code matches the one in the ACPI spec for
> "NFIT Update". Currently there is only one code in the spec, but
> once additional codes are added, older kernels (without this fix)
> will misbehave by assuming all event notifications are for an
> NFIT Update.
> 
> Fixes: 209851649dc4 ("acpi: nfit: Add support for hot-add")
> Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
> ---
> 
> Note that the patch doesn't directly apply to stable-4.4, but using
> 'git am -3' works. Is this sufficient, or should I send a sepatate
> patch for 4.4?

I've made it fit :)

thanks,

greg k-h
diff mbox

Patch

diff --git a/drivers/acpi/nfit.c b/drivers/acpi/nfit.c
index 375c10f..a071fe4 100644
--- a/drivers/acpi/nfit.c
+++ b/drivers/acpi/nfit.c
@@ -2605,6 +2605,9 @@  static void acpi_nfit_notify(struct acpi_device *adev, u32 event)
 
 	dev_dbg(dev, "%s: event: %d\n", __func__, event);
 
+	if (event != NFIT_NOTIFY_UPDATE)
+		return;
+
 	device_lock(dev);
 	if (!dev->driver) {
 		/* dev->driver may be null if we're being removed */
diff --git a/drivers/acpi/nfit.h b/drivers/acpi/nfit.h
index 02b9ea1..e602fd2 100644
--- a/drivers/acpi/nfit.h
+++ b/drivers/acpi/nfit.h
@@ -73,6 +73,10 @@  enum {
 	NFIT_ARS_TIMEOUT = 90,
 };
 
+enum nfit_root_notifiers {
+	NFIT_NOTIFY_UPDATE = 0x80,
+};
+
 struct nfit_spa {
 	struct acpi_nfit_system_address *spa;
 	struct list_head list;