usb-serial: ftdi_sio: fix reference counting of ftdi_private
commitc16199fcd341f10147eb2e29a60aed41ceca55b4
authorAlan Stern <stern@rowland.harvard.edu>
Thu, 30 Apr 2009 14:06:19 +0000 (30 10:06 -0400)
committerGreg Kroah-Hartman <gregkh@suse.de>
Mon, 18 May 2009 23:34:34 +0000 (18 16:34 -0700)
tree788cfa212a260cf02d547ec1009ccf3141cad2de
parent192966f9f34028e04437e29afc0d936be2fc7052
usb-serial: ftdi_sio: fix reference counting of ftdi_private

commit c45d63202fbaccef7ef7946c03f27f72c809b1cc upstream.

This patch (as1238) adds proper reference counting for ftdi_sio's
private data structure.  Without it, the driver will free the
structure while it is still in use if the user unplugs the serial
device before closing the device file.

The patch also replaces a slightly dangerous
cancel_delayed_work/flush_scheduled_work pair with
cancel_delayed_work_sync, which is always safer.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Reported-by: Daniel Mack <daniel@caiaq.de>
Tested-by: Daniel Mack <daniel@caiaq.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/serial/ftdi_sio.c