From: Johan Hovold <johan@kernel.org>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-usb@vger.kernel.org, Josef Bacik <josef@toxicpanda.com>,
stable <stable@kernel.org>
Subject: Re: [PATCH] USB: serial: oti6858: fix the teardown order in close
Date: Thu, 29 Oct 2026 09:54:40 +0100 [thread overview]
Message-ID: <auMJ0J207SUlC6ln@hovoldconsulting.com> (raw)
In-Reply-To: <2026102725-congenial-profound-99ee@gregkh>
On Tue, Oct 27, 2026 at 03:31:26PM +0100, Greg Kroah-Hartman wrote:
> From: Josef Bacik <josef@toxicpanda.com>
>
> The driver passes a baton around: the completion handler of the
> interrupt urb either resubmits the urb, submits the read urb or
> schedules one of the two delayed works, and the works and the bulk
> completion handlers submit the interrupt urb again.
>
> oti6858_close() cancels the works first and kills the urbs afterwards.
> An interrupt urb that completes in between schedules a work again:
>
> oti6858_close()
> cancel_delayed_work_sync(setup)
> cancel_delayed_work_sync(write)
> oti6858_read_int_callback()
> schedule_delayed_work(setup)
> usb_kill_urb(interrupt_in_urb) /* not in flight */
> setup_line()
> usb_submit_urb(interrupt_in_urb)
>
> The port is now closed with the baton still going round. The next open
> fails because the interrupt urb is already submitted, and if the device
> is unplugged, oti6858_port_remove() frees the private data while a work
> may be pending or running.
>
> Poison the interrupt urb first: that waits for the handler and makes all
> further submissions fail, so nothing schedules the works any more. Then
> cancel the works, after which only the bulk urbs are left, kill those,
> and make the interrupt urb usable again for the next open. Don't print
> an error for the submissions that fail with -EPERM in this window, as
> oti6858_read_bulk_callback() already does.
>
> Fixes: 49cdee0ed0fc ("USB: oti6858 usb-serial driver (in Nokia CA-42 cable)")
> Cc: stable <stable@kernel.org>
> Cc: Johan Hovold <johan@kernel.org>
> Signed-off-by: Josef Bacik <josef@toxicpanda.com>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> ---
> Johan, another llm-found patch, seems sane, but it's not exactly obvious
> to me if this is real or not?
Yes, this all looks good. I'll queue this one for 7.4. Thanks.
Johan
prev parent reply other threads:[~2026-10-29 8:54 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-27 14:31 [PATCH] USB: serial: oti6858: fix the teardown order in close Greg Kroah-Hartman
2026-10-27 14:48 ` sashiko-bot
2026-10-29 8:54 ` Johan Hovold [this message]
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=auMJ0J207SUlC6ln@hovoldconsulting.com \
--to=johan@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=josef@toxicpanda.com \
--cc=linux-usb@vger.kernel.org \
--cc=stable@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox