Hi Pete,
On Fri, 16 Jun 2006 21:51:25 -0700
Pete Zaitcev <[EMAIL PROTECTED]> wrote:
| I may be missing something, but the usb-serial seems to miss a kfree
| in a blatant way when it frees "unattached" ports. I looked at the
| way ports are probed, and they are never static, even if they are
| special. Weird...
|
| Also, my fix for flushing the posted work apparently wasn't complete.
| I missed the fact that we free the port elsewhere, so we need two
| flushes, not one.
|
| Greg, does this look sane to you?
|
| --- linux-2.6.17-rc6-git7-gregkh/drivers/usb/serial/usb-serial.c
2006-06-16 21:28:46.000000000 -0700
| +++ linux-2.6.17-rc6-git7-gregkh-v/drivers/usb/serial/usb-serial.c
2006-06-16 21:50:04.000000000 -0700
| @@ -159,11 +159,11 @@ static void destroy_serial(struct kref *
| kfree(port->bulk_out_buffer);
| kfree(port->interrupt_in_buffer);
| kfree(port->interrupt_out_buffer);
| + flush_scheduled_work(); /* port->work */
| + kfree(port);
| }
| }
|
| - flush_scheduled_work(); /* port->work */
| -
| usb_put_dev(serial->dev);
|
| /* free up any memory that we allocated */
| @@ -577,6 +577,7 @@ static void port_release(struct device *
| kfree(port->bulk_out_buffer);
| kfree(port->interrupt_in_buffer);
| kfree(port->interrupt_out_buffer);
| + flush_scheduled_work(); /* port->work */
| kfree(port);
| }
The missed kfree() looks right. All the ports are dynamic allocated and
port_release() will only freed the ports registered with the tty layer
(which is not case for 'fake' ports).
BTW, two suggestions:
1. While you're are at it, please, create a new function to kill
'port', because now the code in port_release() and destroy_serial()
does exactly the same thing (to kill 'port').
2. Just to be safe, do a 'port = NULL' after the call to kfree()
--
Luiz Fernando N. Capitulino
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel