public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] memrar: Address kernel oops during resource cleanup
@ 2010-07-19  8:32 Alan Cox
  2010-07-19  8:32 ` [PATCH 2/2] memrar: Updated maintainer contact information Alan Cox
  0 siblings, 1 reply; 2+ messages in thread
From: Alan Cox @ 2010-07-19  8:32 UTC (permalink / raw)
  To: greg, linux-kernel

From: Ossama Othman <ossama.othman@intel.com>

Some delayed initialization is performed in this driver.  Make sure
resources that are used during driver clean-up (e.g. during driver's
release() function) are fully initialized before first use.  This is
particularly important for the case when the delayed initialization
isn't completed, leaving behind a partially initialized driver.

Such a scenario can occur when RAR is not available on the platform,
and the driver is release()d.

Signed-off-by: Ossama Othman <ossama.othman@intel.com>
Signed-off-by: Alan Cox <alan@linux.intel.com>
---

 drivers/staging/memrar/memrar_handler.c |   28 +++++++++++++++++++---------
 1 files changed, 19 insertions(+), 9 deletions(-)


diff --git a/drivers/staging/memrar/memrar_handler.c b/drivers/staging/memrar/memrar_handler.c
index 5fe6028..a98b3f1 100644
--- a/drivers/staging/memrar/memrar_handler.c
+++ b/drivers/staging/memrar/memrar_handler.c
@@ -278,15 +278,6 @@ static int memrar_init_rar_resources(int rarnum, char const *devname)
 	BUG_ON(!memrar_is_valid_rar_type(rarnum));
 	BUG_ON(rar->allocated);
 
-	mutex_init(&rar->lock);
-
-	/*
-	 * Initialize the process table before we reach any
-	 * code that exit on failure since the finalization
-	 * code requires an initialized list.
-	 */
-	INIT_LIST_HEAD(&rar->buffers.list);
-
 	if (rar_get_address(rarnum, &low, &high) != 0)
 		/* No RAR is available. */
 		return -ENODEV;
@@ -940,9 +931,28 @@ static int memrar_registration_callback(unsigned long rar)
 static int __init memrar_init(void)
 {
 	int err;
+	int i;
 
 	printk(banner);
 
+	/*
+	 * Some delayed initialization is performed in this driver.
+	 * Make sure resources that are used during driver clean-up
+	 * (e.g. during driver's release() function) are fully
+	 * initialized before first use.  This is particularly
+	 * important for the case when the delayed initialization
+	 * isn't completed, leaving behind a partially initialized
+	 * driver.
+	 *
+	 * Such a scenario can occur when RAR is not available on the
+	 * platform, and the driver is release()d.
+	 */
+	for (i = 0; i != ARRAY_SIZE(memrars); ++i) {
+		struct memrar_rar_info * const rar = &memrars[i];
+		mutex_init(&rar->lock);
+		INIT_LIST_HEAD(&rar->buffers.list);
+	}
+
 	err = misc_register(&memrar_miscdev);
 	if (err)
 		return err;


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

* [PATCH 2/2] memrar: Updated maintainer contact information
  2010-07-19  8:32 [PATCH 1/2] memrar: Address kernel oops during resource cleanup Alan Cox
@ 2010-07-19  8:32 ` Alan Cox
  0 siblings, 0 replies; 2+ messages in thread
From: Alan Cox @ 2010-07-19  8:32 UTC (permalink / raw)
  To: greg, linux-kernel

From: Ossama Othman <ossama.othman@intel.com>

Signed-off-by: Ossama Othman <ossama.othman@intel.com>
Signed-off-by: Alan Cox <alan@linux.intel.com>
---

 drivers/staging/memrar/TODO       |    2 +-
 drivers/staging/memrar/memrar-abi |    4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)


diff --git a/drivers/staging/memrar/TODO b/drivers/staging/memrar/TODO
index 0087447..435e09b 100644
--- a/drivers/staging/memrar/TODO
+++ b/drivers/staging/memrar/TODO
@@ -1,7 +1,7 @@
 RAR Handler (memrar) Driver TODO Items
 ======================================
 
-Maintainer: Ossama Othman <ossama.othman@intel.com>
+Maintainer: Eugene Epshteyn <eugene.epshteyn@intel.com>
 
 memrar.h
 --------
diff --git a/drivers/staging/memrar/memrar-abi b/drivers/staging/memrar/memrar-abi
index 98a6bb1..c23fc99 100644
--- a/drivers/staging/memrar/memrar-abi
+++ b/drivers/staging/memrar/memrar-abi
@@ -1,7 +1,7 @@
 What:		/dev/memrar
 Date:		March 2010
-KernelVersion:	Kernel version this feature first showed up in.
-Contact:	Ossama Othman <ossama.othman@intel.com>
+KernelVersion:	2.6.34
+Contact:	Eugene Epshteyn <eugene.epshteyn@intel.com>
 Description:	The Intel Moorestown Restricted Access Region (RAR)
 		Handler driver exposes an ioctl() based interface that
 		allows a user to reserve and release blocks of RAR


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

end of thread, other threads:[~2010-07-19  9:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-19  8:32 [PATCH 1/2] memrar: Address kernel oops during resource cleanup Alan Cox
2010-07-19  8:32 ` [PATCH 2/2] memrar: Updated maintainer contact information Alan Cox

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox