dahdi_dynamic: Release reference count on network device when destroying dynamic spans.

It was reported that for VLAN interfaces, failing to release this reference
count will prevent a system from rebooting properly, resulting in the need to
power cycle.

Reported-by: Assen Totin
Internal-Issue-ID: DAHLIN-343
Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Signed-off-by: Russ Meyerriecks <rmeyerriecks@digium.com>
(cherry picked from commit e005030995)
This commit is contained in:
Shaun Ruffell 2014-12-10 08:39:39 -06:00 committed by Russ Meyerriecks
parent 6dd89a7ae5
commit 9d62e703fe

View File

@ -266,6 +266,7 @@ static void ztdeth_destroy(struct dahdi_dynamic *dyn)
struct ztdeth *z = dyn->pvt;
unsigned long flags;
struct ztdeth *prev=NULL, *cur;
spin_lock_irqsave(&zlock, flags);
cur = zdevs;
while(cur) {
@ -279,12 +280,14 @@ static void ztdeth_destroy(struct dahdi_dynamic *dyn)
prev = cur;
cur = cur->next;
}
spin_unlock_irqrestore(&zlock, flags);
if (cur == z) { /* Successfully removed */
dyn->pvt = NULL;
dev_put(z->dev);
printk(KERN_INFO "TDMoE: Removed interface for %s\n", z->span->name);
kfree(z);
}
spin_unlock_irqrestore(&zlock, flags);
}
static int ztdeth_create(struct dahdi_dynamic *dyn, const char *addr)