Skip to contentSkip to conversation

PPC64: crash during firmware flash update

PATCH New Paul Mackerras 1 participant 1 message Oct 23, 2004

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 PPC64: crash during firmware flash update

This patch is from Linas Vepstas <[email protected]>.

Race conditions during system shutdown after a firmware flash can sometimes lead to an invalid pointer deref (deref to freed memory). This patch fixes this. In addition, it makes sure that the proc entries created by the firmware flash module are removed when the module is unloaded.

arch/ppc64/kernel/rtas_flash.c +3 -1
diff -urN linux-2.5/arch/ppc64/kernel/rtas_flash.c test/arch/ppc64/kernel/rtas_flash.c
@@ -562,6 +562,7 @@
 		validate_flash(args_buf);
 	}
 
+	/* The matching atomic_inc was in rtas_excl_open() */
 	atomic_dec(&dp->count);
 
 	return 0;
@@ -572,7 +573,8 @@
 	if (dp) {
 		if (dp->data != NULL)
 			kfree(dp->data);
-		remove_proc_entry(dp->name, NULL);
+		dp->owner = NULL;
+		remove_proc_entry(dp->name, dp->parent);
 	}
 }