From: Olaf Hering on
protect kernel_sem access with CONFIG_LOCK_KERNEL
lib/kernel_lock.c is compiled conditionally.

Signed-off-by: Olaf Hering <olaf(a)aepfle.de>

---
init/main.c | 4 ++++
kernel/lockdep.c | 2 ++
2 files changed, 6 insertions(+)

--- linux-2.6.33-rt.orig/init/main.c
+++ linux-2.6.33-rt/init/main.c
@@ -629,9 +629,13 @@ asmlinkage void __init start_kernel(void
* the lockdep state, so release the one known lock and
* acquire it again after the self-test is done.
*/
+#ifdef CONFIG_LOCK_KERNEL
mutex_release(&kernel_sem.dep_map, 1, _THIS_IP_);
+#endif
locking_selftest();
+#ifdef CONFIG_LOCK_KERNEL
mutex_acquire(&kernel_sem.dep_map, 0, 0, _THIS_IP_);
+#endif
}

#ifdef CONFIG_BLK_DEV_INITRD
--- linux-2.6.33-rt.orig/kernel/lockdep.c
+++ linux-2.6.33-rt/kernel/lockdep.c
@@ -3608,8 +3608,10 @@ void lockdep_init(void)
for (i = 0; i < CHAINHASH_SIZE; i++)
INIT_LIST_HEAD(chainhash_table + i);

+#ifdef CONFIG_LOCK_KERNEL
/* Hack alert ! */
lockdep_set_novalidate_class(&kernel_sem);
+#endif

lockdep_initialized = 1;
}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/