summaryrefslogtreecommitdiffhomepage
path: root/device.c
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2013-12-16 11:06:57 +0100
committerFelix Fietkau <nbd@openwrt.org>2013-12-16 11:06:57 +0100
commit1a770b186b4bc9e714dbdd30d0c41ea471fa8245 (patch)
tree681395ecd319f2a0de1f628d7afa43626845b1b5 /device.c
parent2851c3bcde8c23f6535b13c80fc486569c288ec7 (diff)
device: prevent callbacks to device users that have been cleaned up already
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Diffstat (limited to 'device.c')
-rw-r--r--device.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/device.c b/device.c
index 56fc3f7..feeb290 100644
--- a/device.c
+++ b/device.c
@@ -185,6 +185,10 @@ static int device_broadcast_cb(void *ctx, struct safe_list *list)
struct device_user *dep = container_of(list, struct device_user, list);
int *ev = ctx;
+ /* device might have been removed by an earlier callback */
+ if (!dep->dev)
+ return 0;
+
if (dep->cb)
dep->cb(dep, *ev);
return 0;