Re: [PATCH] clean tty fields on failed device open

Luiz Fernando N. Capitulino
2006-06-14T14:13:41Z

On Wed, 14 Jun 2006 15:52:05 +0200
Frank Gevaerts <frank.gevaerts@fks.be> wrote:

| On Wed, Jun 14, 2006 at 10:49:18AM -0300, Luiz Fernando N. Capitulino wrote:
| > Hmm, I'd prefer something like this:
|
| OK
|
| If either the driver's open() method or try_module_get() fails, we need to
| set 'tty->driver_data' and 'port->tty' to NULL in serial_open(), otherwise
| we'll get an OOPS in usb_device_disconnect() when the device is disconnected.
|
| Signed-off-by: Frank Gevaerts <frank.gevaerts@fks.be>

Acked-by: Luiz Fernando N. Capitulino <lcapitulino@mandriva.com.br>

|
| diff -urp linux-2.6.17-rc6/drivers/usb/serial/usb-serial.c linux-2.6.17-rc6.a/drivers/usb/serial/usb-serial.c
| --- linux-2.6.17-rc6/drivers/usb/serial/usb-serial.c 2006-06-14 13:03:55.000000000 +0200
| +++ linux-2.6.17-rc6.a/drivers/usb/serial/usb-serial.c 2006-06-14 13:23:34.000000000 +0200
| @@ -230,6 +232,8 @@ bailout_module_put:
| module_put(serial->type->driver.owner);
| bailout_mutex_unlock:
| port->open_count = 0;
| + tty->driver_data = NULL;
| + port->tty = NULL;
| mutex_unlock(&port->mutex);
| bailout_kref_put:
| kref_put(&serial->kref, destroy_serial);
|
| --
| Frank Gevaerts frank.gevaerts@fks.be
| fks bvba - Formal and Knowledge Systems http://www.fks.be/
| Stationsstraat 108 Tel: ++32-(0)11-21 49 11
| B-3570 ALKEN Fax: ++32-(0)11-22 04 19

--
Luiz Fernando N. Capitulino