diff options
| author | Syed Rameez Mustafa <rameezmustafa@codeaurora.org> | 2013-07-15 11:52:09 -0700 |
|---|---|---|
| committer | David Keitel <dkeitel@codeaurora.org> | 2016-03-22 11:16:29 -0700 |
| commit | e2cddd104051ee3f47dddaa0b8d54a5193f0971b (patch) | |
| tree | 3541893ea0c24d5b15621066447568cd942bebc4 /lib/list_debug.c | |
| parent | e594000013901cc6f2c453487815be64a89c113f (diff) | |
kernel/lib: add additional debug capabilites for data corruption
Data corruptions in the kernel often end up in system crashes that
are easier to debug closer to the time of detection. Specifically,
if we do not panic immediately after lock or list corruptions have been
detected, the problem context is lost in the ensuing system mayhem.
Add support for allowing system crash immediately after such corruptions
are detected. The CONFIG option controls the enabling/disabling of the
feature.
Change-Id: I9b2eb62da506a13007acff63e85e9515145909ff
Signed-off-by: Syed Rameez Mustafa <rameezmustafa@codeaurora.org>
[abhimany: minor merge conflict resolution]
Signed-off-by: Abhimanyu Kapur <abhimany@codeaurora.org>
Diffstat (limited to 'lib/list_debug.c')
| -rw-r--r-- | lib/list_debug.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/list_debug.c b/lib/list_debug.c index c24c2f7e296f..8cf180bfaabe 100644 --- a/lib/list_debug.c +++ b/lib/list_debug.c @@ -11,6 +11,7 @@ #include <linux/bug.h> #include <linux/kernel.h> #include <linux/rculist.h> +#include <linux/bug.h> /* * Insert a new entry between two known consecutive entries. @@ -34,6 +35,10 @@ void __list_add(struct list_head *new, WARN(new == prev || new == next, "list_add double add: new=%p, prev=%p, next=%p.\n", new, prev, next); + + BUG_ON((prev->next != next || next->prev != prev || + new == prev || new == next) && PANIC_CORRUPTION); + next->prev = new; new->next = next; new->prev = prev; @@ -59,8 +64,10 @@ void __list_del_entry(struct list_head *entry) "but was %p\n", entry, prev->next) || WARN(next->prev != entry, "list_del corruption. next->prev should be %p, " - "but was %p\n", entry, next->prev)) + "but was %p\n", entry, next->prev)) { + BUG_ON(PANIC_CORRUPTION); return; + } __list_del(prev, next); } |
