On Mon, 2009-12-07 at 17:58 +0000, Alan Cox wrote: > > + if (acm->port.count) { > > + tty = tty_port_tty_get(&acm->port); > > + if (tty) { > > + tty_hangup(tty); > > + tty_kref_put(tty); > > + } > > What locking do you have against a parallel open, hangup or close event on > another CPU ? > > Alan Added proper locking. Signed-off-by: Francesco Lavra <francescolavra@xxxxxxxxxxxx> --- a/drivers/usb/class/cdc-acm.c 2009-12-07 16:22:20.000000000 +0100 +++ b/drivers/usb/class/cdc-acm.c 2009-12-07 19:11:43.000000000 +0100 @@ -1460,6 +1460,23 @@ err_out: return rv; } +static int acm_reset_resume(struct usb_interface *intf) +{ + struct acm *acm = usb_get_intfdata(intf); + struct tty_struct *tty; + + mutex_lock(&open_mutex); + if (acm->port.count) { + tty = tty_port_tty_get(&acm->port); + if (tty) { + tty_hangup(tty); + tty_kref_put(tty); + } + } + mutex_unlock(&open_mutex); + return acm_resume(intf); +} + #endif /* CONFIG_PM */ /* * USB driver structure. @@ -1546,6 +1563,7 @@ static struct usb_driver acm_driver = { #ifdef CONFIG_PM .suspend = acm_suspend, .resume = acm_resume, + .reset_resume = acm_reset_resume, #endif .id_table = acm_ids, #ifdef CONFIG_PM -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html