diff options
-rw-r--r-- | kernel/lockdep.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/kernel/lockdep.c b/kernel/lockdep.c index bc4d32871f9a..42ba65dff7d9 100644 --- a/kernel/lockdep.c +++ b/kernel/lockdep.c | |||
@@ -639,6 +639,16 @@ look_up_lock_class(struct lockdep_map *lock, unsigned int subclass) | |||
639 | } | 639 | } |
640 | #endif | 640 | #endif |
641 | 641 | ||
642 | if (unlikely(subclass >= MAX_LOCKDEP_SUBCLASSES)) { | ||
643 | debug_locks_off(); | ||
644 | printk(KERN_ERR | ||
645 | "BUG: looking up invalid subclass: %u\n", subclass); | ||
646 | printk(KERN_ERR | ||
647 | "turning off the locking correctness validator.\n"); | ||
648 | dump_stack(); | ||
649 | return NULL; | ||
650 | } | ||
651 | |||
642 | /* | 652 | /* |
643 | * Static locks do not have their class-keys yet - for them the key | 653 | * Static locks do not have their class-keys yet - for them the key |
644 | * is the lock object itself: | 654 | * is the lock object itself: |
@@ -2745,14 +2755,6 @@ static int __lock_acquire(struct lockdep_map *lock, unsigned int subclass, | |||
2745 | if (DEBUG_LOCKS_WARN_ON(!irqs_disabled())) | 2755 | if (DEBUG_LOCKS_WARN_ON(!irqs_disabled())) |
2746 | return 0; | 2756 | return 0; |
2747 | 2757 | ||
2748 | if (unlikely(subclass >= MAX_LOCKDEP_SUBCLASSES)) { | ||
2749 | debug_locks_off(); | ||
2750 | printk("BUG: MAX_LOCKDEP_SUBCLASSES too low!\n"); | ||
2751 | printk("turning off the locking correctness validator.\n"); | ||
2752 | dump_stack(); | ||
2753 | return 0; | ||
2754 | } | ||
2755 | |||
2756 | if (lock->key == &__lockdep_no_validate__) | 2758 | if (lock->key == &__lockdep_no_validate__) |
2757 | check = 1; | 2759 | check = 1; |
2758 | 2760 | ||