[asterisk-bugs] [DAHDI-linux 0018422]: dahdi-base locks channel-exporting module in kernel if channel open fails
Asterisk Bug Tracker
noreply at bugs.digium.com
Fri Dec 3 23:21:18 CST 2010
The following issue has been SUBMITTED.
======================================================================
https://issues.asterisk.org/view.php?id=18422
======================================================================
Reported By: avarvit
Assigned To:
======================================================================
Project: DAHDI-linux
Issue ID: 18422
Category: dahdi (the module)
Reproducibility: always
Severity: major
Priority: normal
Status: new
JIRA:
Reviewboard Link:
======================================================================
Date Submitted: 2010-12-03 23:21 CST
Last Modified: 2010-12-03 23:21 CST
======================================================================
Summary: dahdi-base locks channel-exporting module in kernel
if channel open fails
Description:
Read dahdi-base.c, circa line 2714:
if (chan->span) {
if (!try_module_get(chan->span->ops->owner))
res = -ENXIO;
else if (chan->span->ops->open)
res = chan->span->ops->open(chan);
}
if (!res) {
chan->file = file;
spin_unlock_irqrestore(&chan->lock, flags);
} else {
spin_unlock_irqrestore(&chan->lock, flags);
close_channel(chan);
clear_bit(DAHDI_FLAGBIT_OPEN, &chan->flags);
}
If chan->span->ops->open() fails, then DAHDI_FLAGBIT_OPEN never
gets set and module_put is never called on the exporter module.
The following patch fixes the problem (call module_put() if open
fails).
if (chan->span) {
if (!try_module_get(chan->span->owner))
res = -ENXIO;
else if (chan->span->open) {
res = chan->span->open(chan);
/* avarvit patch */
if (res) {
module_put(chan->span->owner);
}
}
}
if (!res) {
chan->file = file;
spin_unlock_irqrestore(&chan->lock,
flags);
} else {
spin_unlock_irqrestore(&chan->lock,
flags);
close_channel(chan);
clear_bit(DAHDI_FLAGBIT_OPEN,
&chan->flags);
}
======================================================================
Issue History
Date Modified Username Field Change
======================================================================
2010-12-03 23:21 avarvit New Issue
======================================================================
More information about the asterisk-bugs
mailing list