[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20170725192020.816314419@linuxfoundation.org>
Date: Tue, 25 Jul 2017 12:20:34 -0700
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: linux-kernel@...r.kernel.org
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
stable@...r.kernel.org, "Rafael J. Wysocki" <rjw@...ysocki.net>,
Len Brown <lenb@...nel.org>,
Vishal Verma <vishal.l.verma@...el.com>,
"Lee, Chun-Yi" <joeyli.kernel@...il.com>,
Linda Knippers <linda.knippers@....com>, lszubowi@...hat.com,
Jeff Moyer <jmoyer@...hat.com>,
Prarit Bhargava <prarit@...hat.com>,
Dan Williams <dan.j.williams@...el.com>
Subject: [PATCH 4.9 119/125] acpi/nfit: Fix memory corruption/Unregister mce decoder on failure
4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Prarit Bhargava <prarit@...hat.com>
commit 7e700d2c59e5853c9126642976b4f5768f64c9b3 upstream.
nfit_init() calls nfit_mce_register() on module load. When the module
load fails the nfit mce decoder is not unregistered. The module's
memory is freed leaving the decoder chain referencing junk. This will
cause panics as future registrations will reference the free'd memory.
Unregister the nfit mce decoder on module init failure.
[v2]: register and then unregister mce handler to avoid losing mce events
[v3]: also cleanup nfit workqueue
Fixes: 6839a6d96f4e ("nfit: do an ARS scrub on hitting a latent media error")
Cc: "Rafael J. Wysocki" <rjw@...ysocki.net>
Cc: Len Brown <lenb@...nel.org>
Cc: Vishal Verma <vishal.l.verma@...el.com>
Cc: "Lee, Chun-Yi" <joeyli.kernel@...il.com>
Cc: Linda Knippers <linda.knippers@....com>
Cc: lszubowi@...hat.com
Acked-by: Jeff Moyer <jmoyer@...hat.com>
Signed-off-by: Prarit Bhargava <prarit@...hat.com>
Reviewed-by: Vishal Verma <vishal.l.verma@...el.com>
Signed-off-by: Dan Williams <dan.j.williams@...el.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
---
drivers/acpi/nfit/core.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
--- a/drivers/acpi/nfit/core.c
+++ b/drivers/acpi/nfit/core.c
@@ -2945,6 +2945,8 @@ static struct acpi_driver acpi_nfit_driv
static __init int nfit_init(void)
{
+ int ret;
+
BUILD_BUG_ON(sizeof(struct acpi_table_nfit) != 40);
BUILD_BUG_ON(sizeof(struct acpi_nfit_system_address) != 56);
BUILD_BUG_ON(sizeof(struct acpi_nfit_memory_map) != 48);
@@ -2972,8 +2974,14 @@ static __init int nfit_init(void)
return -ENOMEM;
nfit_mce_register();
+ ret = acpi_bus_register_driver(&acpi_nfit_driver);
+ if (ret) {
+ nfit_mce_unregister();
+ destroy_workqueue(nfit_wq);
+ }
+
+ return ret;
- return acpi_bus_register_driver(&acpi_nfit_driver);
}
static __exit void nfit_exit(void)
Powered by blists - more mailing lists