From: Felix Fietkau Date: Mon, 16 Dec 2013 10:06:57 +0000 (+0100) Subject: device: prevent callbacks to device users that have been cleaned up already X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=1a770b186b4bc9e714dbdd30d0c41ea471fa8245;p=oweals%2Fnetifd.git device: prevent callbacks to device users that have been cleaned up already Signed-off-by: Felix Fietkau --- 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;