mirror of
https://github.com/Telecominfraproject/wlan-ap.git
synced 2025-12-19 10:23:03 +00:00
128 lines
4.8 KiB
Diff
128 lines
4.8 KiB
Diff
From 1d79518dee2de6f5ad72c13bd291077e3a06acbf Mon Sep 17 00:00:00 2001
|
|
From: Tian Yang <tiany@codeaurora.org>
|
|
Date: Thu, 27 Oct 2016 11:46:24 -0500
|
|
Subject: [PATCH] Add notifier interface
|
|
|
|
Add a notifier interface for the SKB recycler. This notifier will
|
|
propagate events related to skb problems (double free, double alloc,
|
|
checksum mismatch).
|
|
|
|
The following change is merged together:
|
|
|
|
Don't call BUG_ON in the notifier
|
|
|
|
The notifier was meant to be terminal, i.e. after propagating the
|
|
event it stops the system.
|
|
This is causing confusion however, under the assumption that there is
|
|
an actual problem in the notifier code.
|
|
|
|
This commit removes the BUG_ON call in the notifier, so that the event
|
|
originator gets to stop the system (as it was done before the notifier
|
|
was introduced).
|
|
|
|
Change Id: I5a7af0374dc4991539d742712331de03aa3833d1
|
|
Author and Committer: Cristian Prundeanu <cprundea@codeaurora.org>
|
|
|
|
Change-Id: I35262581ad964ef97d21946a965170531ca9034f
|
|
Signed-off-by: Cristian Prundeanu <cprundea@codeaurora.org>
|
|
Signed-off-by: Casey Chen <kexinc@codeaurora.org>
|
|
Signed-off-by: Tian Yang <tiany@codeaurora.org>
|
|
---
|
|
MAINTAINERS | 1 +
|
|
include/linux/debugobjects.h | 14 ++++++++------
|
|
lib/debugobjects.c | 23 +++++++++++++++++++++++
|
|
net/core/Makefile | 2 +-
|
|
4 files changed, 33 insertions(+), 7 deletions(-)
|
|
|
|
diff --git a/MAINTAINERS b/MAINTAINERS
|
|
index f474b10b98a3..94f24712b568 100644
|
|
--- a/MAINTAINERS
|
|
+++ b/MAINTAINERS
|
|
@@ -148,6 +148,7 @@ M: Casey Chen <kexinc@codeaurora.org>
|
|
S: Maintained
|
|
F: net/core/skbuff_recycle.*
|
|
F: net/core/skbuff_debug.*
|
|
+F: net/core/skbuff_notifier.*
|
|
|
|
3C59X NETWORK DRIVER
|
|
M: Steffen Klassert <klassert@kernel.org>
|
|
diff --git a/include/linux/debugobjects.h b/include/linux/debugobjects.h
|
|
index 32444686b6ff..368f1b7148b4 100644
|
|
--- a/include/linux/debugobjects.h
|
|
+++ b/include/linux/debugobjects.h
|
|
@@ -66,12 +66,13 @@ struct debug_obj_descr {
|
|
#ifdef CONFIG_DEBUG_OBJECTS
|
|
extern void debug_object_init (void *addr, const struct debug_obj_descr *descr);
|
|
extern void
|
|
-debug_object_init_on_stack(void *addr, const struct debug_obj_descr *descr);
|
|
-extern int debug_object_activate (void *addr, const struct debug_obj_descr *descr);
|
|
-extern void debug_object_deactivate(void *addr, const struct debug_obj_descr *descr);
|
|
-extern void debug_object_destroy (void *addr, const struct debug_obj_descr *descr);
|
|
-extern void debug_object_free (void *addr, const struct debug_obj_descr *descr);
|
|
-extern void debug_object_assert_init(void *addr, const struct debug_obj_descr *descr);
|
|
+debug_object_init_on_stack(void *addr, struct debug_obj_descr *descr);
|
|
+extern int debug_object_activate (void *addr, struct debug_obj_descr *descr);
|
|
+extern int debug_object_get_state(void *addr);
|
|
+extern void debug_object_deactivate(void *addr, struct debug_obj_descr *descr);
|
|
+extern void debug_object_destroy (void *addr, struct debug_obj_descr *descr);
|
|
+extern void debug_object_free (void *addr, struct debug_obj_descr *descr);
|
|
+extern void debug_object_assert_init(void *addr, struct debug_obj_descr *descr);
|
|
|
|
/*
|
|
* Active state:
|
|
@@ -85,6 +86,7 @@ debug_object_active_state(void *addr, const struct debug_obj_descr *descr,
|
|
extern void debug_objects_early_init(void);
|
|
extern void debug_objects_mem_init(void);
|
|
#else
|
|
+static inline int debug_object_get_state(void *addr) { return 0; }
|
|
static inline void
|
|
debug_object_init (void *addr, const struct debug_obj_descr *descr) { }
|
|
static inline void
|
|
diff --git a/lib/debugobjects.c b/lib/debugobjects.c
|
|
index c46736210363..2fa0c3277083 100644
|
|
--- a/lib/debugobjects.c
|
|
+++ b/lib/debugobjects.c
|
|
@@ -493,6 +493,29 @@ static struct debug_bucket *get_bucket(unsigned long addr)
|
|
return &obj_hash[hash];
|
|
}
|
|
|
|
+/*
|
|
+ * debug_object_get_state():
|
|
+ * returns the state of an object given an address
|
|
+ */
|
|
+int debug_object_get_state(void *addr)
|
|
+{
|
|
+ struct debug_bucket *db;
|
|
+ struct debug_obj *obj;
|
|
+ unsigned long flags;
|
|
+ enum debug_obj_state state = ODEBUG_STATE_NOTAVAILABLE;
|
|
+
|
|
+ db = get_bucket((unsigned long) addr);
|
|
+
|
|
+ raw_spin_lock_irqsave(&db->lock, flags);
|
|
+ obj = lookup_object(addr, db);
|
|
+ if (obj)
|
|
+ state = obj->state;
|
|
+ raw_spin_unlock_irqrestore(&db->lock, flags);
|
|
+
|
|
+ return state;
|
|
+}
|
|
+EXPORT_SYMBOL(debug_object_get_state);
|
|
+
|
|
static void debug_print_object(struct debug_obj *obj, char *msg)
|
|
{
|
|
const struct debug_obj_descr *descr = obj->descr;
|
|
diff --git a/net/core/Makefile b/net/core/Makefile
|
|
index 2f2e6042facf..7f0b9fe8d50a 100644
|
|
--- a/net/core/Makefile
|
|
+++ b/net/core/Makefile
|
|
@@ -42,4 +42,4 @@ obj-$(CONFIG_BPF_SYSCALL) += sock_map.o
|
|
obj-$(CONFIG_BPF_SYSCALL) += bpf_sk_storage.o
|
|
obj-$(CONFIG_OF) += of_net.o
|
|
obj-$(CONFIG_SKB_RECYCLER) += skbuff_recycle.o
|
|
-obj-$(CONFIG_DEBUG_OBJECTS_SKBUFF) += skbuff_debug.o
|
|
+obj-$(CONFIG_DEBUG_OBJECTS_SKBUFF) += skbuff_debug.o skbuff_notifier.o
|
|
--
|
|
2.34.1
|
|
|