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, ...@@ -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.txtp,vcc->qos.aal);
if (!error) error = adjust_tp(&vcc->qos.rxtp,vcc->qos.aal); if (!error) error = adjust_tp(&vcc->qos.rxtp,vcc->qos.aal);
if (error) { if (error)
vcc_remove_socket(vcc->sk); goto fail;
return error;
}
DPRINTK("VCC %d.%d, AAL %d\n",vpi,vci,vcc->qos.aal); 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, 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); 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, 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); vcc->qos.rxtp.min_pcr,vcc->qos.rxtp.max_pcr,vcc->qos.rxtp.max_sdu);
if (!try_module_get(dev->ops->owner)) if (!try_module_get(dev->ops->owner)) {
return -ENODEV; error = -ENODEV;
goto fail;
}
if (dev->ops->open) { if (dev->ops->open) {
error = dev->ops->open(vcc,vpi,vci); if ((error = dev->ops->open(vcc,vpi,vci)))
if (error) { goto put_module_fail;
module_put(dev->ops->owner);
vcc_remove_socket(vcc->sk);
return error;
}
} }
return 0; 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