This is a note to let you know that I've just added the patch titled USB: serial: cyberjack: fix write-URB completion race to the 4.14-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: usb-serial-cyberjack-fix-write-urb-completion-race.patch and it can be found in the queue-4.14 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From 985616f0457d9f555fff417d0da56174f70cc14f Mon Sep 17 00:00:00 2001 From: Johan Hovold <johan@xxxxxxxxxx> Date: Mon, 26 Oct 2020 09:25:48 +0100 Subject: USB: serial: cyberjack: fix write-URB completion race From: Johan Hovold <johan@xxxxxxxxxx> commit 985616f0457d9f555fff417d0da56174f70cc14f upstream. The write-URB busy flag was being cleared before the completion handler was done with the URB, something which could lead to corrupt transfers due to a racing write request if the URB is resubmitted. Fixes: 507ca9bc0476 ("[PATCH] USB: add ability for usb-serial drivers to determine if their write urb is currently being used.") Cc: stable <stable@xxxxxxxxxxxxxxx> # 2.6.13 Reviewed-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> Signed-off-by: Johan Hovold <johan@xxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- drivers/usb/serial/cyberjack.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) --- a/drivers/usb/serial/cyberjack.c +++ b/drivers/usb/serial/cyberjack.c @@ -358,11 +358,12 @@ static void cyberjack_write_bulk_callbac struct cyberjack_private *priv = usb_get_serial_port_data(port); struct device *dev = &port->dev; int status = urb->status; + bool resubmitted = false; - set_bit(0, &port->write_urbs_free); if (status) { dev_dbg(dev, "%s - nonzero write bulk status received: %d\n", __func__, status); + set_bit(0, &port->write_urbs_free); return; } @@ -395,6 +396,8 @@ static void cyberjack_write_bulk_callbac goto exit; } + resubmitted = true; + dev_dbg(dev, "%s - priv->wrsent=%d\n", __func__, priv->wrsent); dev_dbg(dev, "%s - priv->wrfilled=%d\n", __func__, priv->wrfilled); @@ -411,6 +414,8 @@ static void cyberjack_write_bulk_callbac exit: spin_unlock(&priv->lock); + if (!resubmitted) + set_bit(0, &port->write_urbs_free); usb_serial_port_softint(port); } Patches currently in stable-queue which might be from johan@xxxxxxxxxx are queue-4.14/usb-serial-option-add-le910cx-compositions-0x1203-0x1230-0x1231.patch queue-4.14/usb-serial-cyberjack-fix-write-urb-completion-race.patch queue-4.14/usb-serial-option-add-telit-fn980-composition-0x1055.patch queue-4.14/usb-serial-option-add-quectel-ec200t-module-support.patch