Re: [PATCH, RFC 15/30] usbserial: stop using interruptible_sleep_on

From: Johan Hovold
Date: Thu Jan 02 2014 - 16:36:18 EST


Hi Arnd,

On Thu, Jan 02, 2014 at 01:07:39PM +0100, Arnd Bergmann wrote:
> We really want to kill off interruptible_sleep_on, which is defined
> in a way that is always racy. There are four usb-serial drivers using
> it to implement their tiocmiwait() functions, which is defined in
> a way that always has a race when called from user space.
>
> This patch changes the four drivers in the same way to use an open-coded
> prepare_to_wait/finish_wait loop to get rid of the deprecated function
> call, but it does not address the fundamental race.
>
> This particular method of implementing it was chosen because it is
> least invasive, a better but more invasive alternative would be
> to use usb_serial_generic_tiocmiwait, which is something I did not
> dare try without access to hardware.

I'd prefer to just fix the race once and for all. These four drivers
have been on my todo list since I converted the other usb-serial drivers
about a year ago. In fact, I posted a fix for f81232 last week, and
I've had a fix for pl2303 brewing as part of larger series for quite
some time.

I'll post a conversion series to linux-usb shortly and make sure to keep
you CC:ed on the sleep_on-killing patches.

Thanks,
Johan

> Signed-off-by: Arnd Bergmann <arnd@xxxxxxxx>
> Cc: Johan Hovold <jhovold@xxxxxxxxx>
> Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
> Cc: linux-usb@xxxxxxxxxxxxxxx
> ---
> drivers/usb/serial/ch341.c | 29 ++++++++++++++++--------
> drivers/usb/serial/cypress_m8.c | 49 ++++++++++++++++++++++++++---------------
> drivers/usb/serial/f81232.c | 29 ++++++++++++++++--------
> drivers/usb/serial/pl2303.c | 29 ++++++++++++++++--------
> 4 files changed, 91 insertions(+), 45 deletions(-)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/