Commit a203da95 authored by Chas Williams's avatar Chas Williams Committed by David S. Miller

[ATM]: fix atm_dev module refcount bug (from levon@movementarian.org)

parent cc81ac77
......@@ -422,26 +422,31 @@ static int __vcc_connect(struct atm_vcc *vcc, struct atm_dev *dev, int vpi,
}
if (!error) error = adjust_tp(&vcc->qos.txtp,vcc->qos.aal);
if (!error) error = adjust_tp(&vcc->qos.rxtp,vcc->qos.aal);
if (error) {
vcc_remove_socket(vcc->sk);
return error;
}
if (error)
goto fail;
DPRINTK("VCC %d.%d, AAL %d\n",vpi,vci,vcc->qos.aal);
DPRINTK(" TX: %d, PCR %d..%d, SDU %d\n",vcc->qos.txtp.traffic_class,
vcc->qos.txtp.min_pcr,vcc->qos.txtp.max_pcr,vcc->qos.txtp.max_sdu);
DPRINTK(" RX: %d, PCR %d..%d, SDU %d\n",vcc->qos.rxtp.traffic_class,
vcc->qos.rxtp.min_pcr,vcc->qos.rxtp.max_pcr,vcc->qos.rxtp.max_sdu);
if (!try_module_get(dev->ops->owner))
return -ENODEV;
if (!try_module_get(dev->ops->owner)) {
error = -ENODEV;
goto fail;
}
if (dev->ops->open) {
error = dev->ops->open(vcc,vpi,vci);
if (error) {
module_put(dev->ops->owner);
vcc_remove_socket(vcc->sk);
return error;
}
if ((error = dev->ops->open(vcc,vpi,vci)))
goto put_module_fail;
}
return 0;
put_module_fail:
module_put(dev->ops->owner);
fail:
vcc_remove_socket(vcc->sk);
/* ensure we get dev module ref count correct */
vcc->dev = NULL;
return error;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment