From 1a770b186b4bc9e714dbdd30d0c41ea471fa8245 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Mon, 16 Dec 2013 11:06:57 +0100 Subject: [PATCH] device: prevent callbacks to device users that have been cleaned up already Signed-off-by: Felix Fietkau --- device.c | 4 ++++ 1 file changed, 4 insertions(+) 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; -- 2.25.1