From: Oliver Neukum <oneukum@suse.com>
To: gregkh@linuxfoundation.org, bjorn@mork.no,
loic.poulain@linaro.org, linux-usb@vger.kernel.org,
netdev@vger.kernel.org
Cc: Oliver Neukum <oneukum@suse.com>
Subject: [PATCH 2/4] USB: wdm: close race between wdm_open and wdm_wwan_port_stop
Date: Mon, 31 Mar 2025 15:25:02 +0200 [thread overview]
Message-ID: <20250331132614.51902-3-oneukum@suse.com> (raw)
In-Reply-To: <20250331132614.51902-1-oneukum@suse.com>
Clearing WDM_WWAN_IN_USE must be the last action or
we can open a chardev whose URBs are still poisoned
Fixes: cac6fb015f71 ("usb: class: cdc-wdm: WWAN framework integration")
Signed-off-by: Oliver Neukum <oneukum@suse.com>
---
drivers/usb/class/cdc-wdm.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/usb/class/cdc-wdm.c b/drivers/usb/class/cdc-wdm.c
index 12038aa43942..e67844618da6 100644
--- a/drivers/usb/class/cdc-wdm.c
+++ b/drivers/usb/class/cdc-wdm.c
@@ -870,8 +870,9 @@ static void wdm_wwan_port_stop(struct wwan_port *port)
poison_urbs(desc);
desc->manage_power(desc->intf, 0);
clear_bit(WDM_READ, &desc->flags);
- clear_bit(WDM_WWAN_IN_USE, &desc->flags);
unpoison_urbs(desc);
+ /* this must be last lest we open a poisoned device */
+ clear_bit(WDM_WWAN_IN_USE, &desc->flags);
}
static void wdm_wwan_port_tx_complete(struct urb *urb)
--
2.49.0
next prev parent reply other threads:[~2025-03-31 13:26 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-31 13:25 [PATCH 0/4] USB: wdm: fix WWAN integration issue Oliver Neukum
2025-03-31 13:25 ` [PATCH 1/4] USB: wdm: handle IO errors in wdm_wwan_port_start Oliver Neukum
2025-03-31 13:25 ` Oliver Neukum [this message]
2025-03-31 14:37 ` [PATCH 2/4] USB: wdm: close race between wdm_open and wdm_wwan_port_stop Alan Stern
2025-03-31 13:25 ` [PATCH 3/4] USB: wdm: wdm_wwan_port_tx_complete mutex in atomic context Oliver Neukum
2025-03-31 13:25 ` [PATCH 4/4] USB: wdm: add annotation Oliver Neukum
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=20250331132614.51902-3-oneukum@suse.com \
--to=oneukum@suse.com \
--cc=bjorn@mork.no \
--cc=gregkh@linuxfoundation.org \
--cc=linux-usb@vger.kernel.org \
--cc=loic.poulain@linaro.org \
--cc=netdev@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).