From: Johan Hovold <johan@kernel.org>
To: Johan Hovold <johan@kernel.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org
Subject: [PATCH 01/11] USB: serial: digi_acceleport: fix port registration order
Date: Wed, 10 Jun 2026 15:22:22 +0200 [thread overview]
Message-ID: <20260610132232.356139-2-johan@kernel.org> (raw)
In-Reply-To: <20260610132232.356139-1-johan@kernel.org>
The driver submits the read URBs for all ports when the first port is
opened, which could happen before the other ports have been probed and
their private data set up.
If such an URB completes before the port has been probed, the completion
handler will not resubmit it, thus preventing any further reads.
Fix the ordering issue by not submitting the port read URBs until the
port is opened.
This also avoids wasting resources (e.g. power) when ports are not in
use.
Note that the port write URBs are already stopped on close (unless
unbinding, but they are also stopped by core on disconnect).
Fixes: fb44ff854e14 ("USB: digi_acceleport: fix port-data memory leak")
Cc: stable@vger.kernel.org # 3.7
Signed-off-by: Johan Hovold <johan@kernel.org>
---
drivers/usb/serial/digi_acceleport.c | 43 ++++++++++++++--------------
1 file changed, 22 insertions(+), 21 deletions(-)
diff --git a/drivers/usb/serial/digi_acceleport.c b/drivers/usb/serial/digi_acceleport.c
index a75813a57fbe..d10d60b5d356 100644
--- a/drivers/usb/serial/digi_acceleport.c
+++ b/drivers/usb/serial/digi_acceleport.c
@@ -1096,6 +1096,13 @@ static int digi_open(struct tty_struct *tty, struct usb_serial_port *port)
not_termios.c_iflag = ~tty->termios.c_iflag;
digi_set_termios(tty, port, ¬_termios);
}
+
+ ret = usb_submit_urb(port->read_urb, GFP_KERNEL);
+ if (ret) {
+ dev_err(&port->dev, "failed to submit read urb: %d\n", ret);
+ return ret;
+ }
+
return 0;
}
@@ -1107,6 +1114,8 @@ static void digi_close(struct usb_serial_port *port)
unsigned char buf[32];
struct digi_port *priv = usb_get_serial_port_data(port);
+ usb_kill_urb(port->read_urb);
+
mutex_lock(&port->serial->disc_mutex);
/* if disconnected, just clear flags */
if (port->serial->disconnected)
@@ -1169,15 +1178,15 @@ static void digi_close(struct usb_serial_port *port)
/*
* Digi Startup Device
*
- * Starts reads on all ports. Must be called AFTER startup, with
+ * Starts read on the OOB port. Must be called AFTER startup, with
* urbs initialized. Returns 0 if successful, non-zero error otherwise.
*/
static int digi_startup_device(struct usb_serial *serial)
{
- int i, ret = 0;
struct digi_serial *serial_priv = usb_get_serial_data(serial);
- struct usb_serial_port *port;
+ struct usb_serial_port *oob_port = serial_priv->ds_oob_port;
+ int ret;
/* be sure this happens exactly once */
spin_lock(&serial_priv->ds_serial_lock);
@@ -1188,19 +1197,13 @@ static int digi_startup_device(struct usb_serial *serial)
serial_priv->ds_device_started = 1;
spin_unlock(&serial_priv->ds_serial_lock);
- /* start reading from each bulk in endpoint for the device */
- /* set USB_DISABLE_SPD flag for write bulk urbs */
- for (i = 0; i < serial->type->num_ports + 1; i++) {
- port = serial->port[i];
- ret = usb_submit_urb(port->read_urb, GFP_KERNEL);
- if (ret != 0) {
- dev_err(&port->dev,
- "%s: usb_submit_urb failed, ret=%d, port=%d\n",
- __func__, ret, i);
- break;
- }
+ ret = usb_submit_urb(oob_port->read_urb, GFP_KERNEL);
+ if (ret) {
+ dev_err(&serial->interface->dev, "failed to submit OOB read urb: %d\n", ret);
+ return ret;
}
- return ret;
+
+ return 0;
}
static int digi_port_init(struct usb_serial_port *port, unsigned port_num)
@@ -1252,13 +1255,11 @@ static int digi_startup(struct usb_serial *serial)
static void digi_disconnect(struct usb_serial *serial)
{
- int i;
+ struct digi_serial *serial_priv = usb_get_serial_data(serial);
+ struct usb_serial_port *oob_port = serial_priv->ds_oob_port;
- /* stop reads and writes on all ports */
- for (i = 0; i < serial->type->num_ports + 1; i++) {
- usb_kill_urb(serial->port[i]->read_urb);
- usb_kill_urb(serial->port[i]->write_urb);
- }
+ usb_kill_urb(oob_port->read_urb);
+ usb_kill_urb(oob_port->write_urb);
}
--
2.53.0
next prev parent reply other threads:[~2026-06-10 13:22 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-10 13:22 [PATCH 00/11] USB: serial: digi_acceleport: registration fix and cleanups Johan Hovold
2026-06-10 13:22 ` Johan Hovold [this message]
2026-06-10 13:22 ` [PATCH 02/11] USB: serial: digi_acceleport: drop unused wait queue Johan Hovold
2026-06-10 13:22 ` [PATCH 03/11] USB: serial: digi_acceleport: always stop write urb on close Johan Hovold
2026-06-10 13:22 ` [PATCH 04/11] USB: serial: digi_acceleport: add oob port helper Johan Hovold
2026-06-10 13:22 ` [PATCH 05/11] USB: serial: digi_acceleport: clean up declarations and whitespace Johan Hovold
2026-06-10 13:22 ` [PATCH 06/11] USB: serial: digi_acceleport: drop redundant driver data sanity checks Johan Hovold
2026-06-10 13:22 ` [PATCH 07/11] USB: serial: digi_acceleport: stop OOB I/O when not in use Johan Hovold
2026-06-10 13:22 ` [PATCH 08/11] USB: serial: digi_acceleport: drop unused in-buf define Johan Hovold
2026-06-10 13:22 ` [PATCH 09/11] USB: serial: digi_acceleport: clean up xfer buf length expression Johan Hovold
2026-06-10 13:22 ` [PATCH 10/11] USB: serial: digi_acceleport: clean up write completion Johan Hovold
2026-06-10 13:22 ` [PATCH 11/11] USB: serial: digi_acceleport: clean up inb command submission Johan Hovold
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260610132232.356139-2-johan@kernel.org \
--to=johan@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.