blob: 1fb18b3225255a580b8d2c1f7b0027c98e4d4ab6 [file] [log] [blame]
From 2737cff12eb197cb711f4e5b84a76b9e2b76ef7b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= <>
Date: Tue, 9 Jul 2013 00:26:32 +0200
Subject: [PATCH] list_bl.h: fix it for for !SMP && !DEBUG_SPINLOCK
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The patch "list_bl.h: make list head locking RT safe" introduced
an unconditional
__set_bit(0, (unsigned long *)b);
in void hlist_bl_lock(struct hlist_bl_head *b). This clobbers the value
of b->first. When the value of b->first is retrieved using
hlist_bl_first the clobbering is undone using
(unsigned long)h->first & ~LIST_BL_LOCKMASK
and so depending on LIST_BL_LOCKMASK being one. But LIST_BL_LOCKMASK is
only one if at least on of CONFIG_SMP and CONFIG_DEBUG_SPINLOCK are
defined. Without these the value returned by hlist_bl_first has the
zeroth bit set which likely results in a crash.
So only do the clobbering in the cases where LIST_BL_LOCKMASK is one.
An alternative would be to always define LIST_BL_LOCKMASK to one with
Acked-by: Paul Gortmaker <>
Tested-by: Paul Gortmaker <>
Signed-off-by: Uwe Kleine-Kรถnig <>
Signed-off-by: Sebastian Andrzej Siewior <>
include/linux/list_bl.h | 4 ++++
1 file changed, 4 insertions(+)
--- a/include/linux/list_bl.h
+++ b/include/linux/list_bl.h
@@ -131,8 +131,10 @@ static inline void hlist_bl_lock(struct
bit_spin_lock(0, (unsigned long *)b);
+#if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK)
__set_bit(0, (unsigned long *)b);
static inline void hlist_bl_unlock(struct hlist_bl_head *b)
@@ -140,7 +142,9 @@ static inline void hlist_bl_unlock(struc
__bit_spin_unlock(0, (unsigned long *)b);
+#if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK)
__clear_bit(0, (unsigned long *)b);