public inbox for linux-wireless@vger.kernel.org
 help / color / mirror / Atom feed
From: Heitor Alves de Siqueira <halves@igalia.com>
To: Johannes Berg <johannes.berg@intel.com>,
	 Szymon Wilczek <swilczek.lx@gmail.com>
Cc: linux-wireless@vger.kernel.org, libertas-dev@lists.infradead.org,
	 linux-kernel@vger.kernel.org, kernel-dev@igalia.com,
	 syzbot+74afbb6355826ffc2239@syzkaller.appspotmail.com
Subject: [PATCH 2/2] wifi: libertas: don't kill URBs in interrupt context
Date: Fri, 13 Mar 2026 18:27:58 -0300	[thread overview]
Message-ID: <20260313-libertas-usb-anchors-v1-2-915afbe988d7@igalia.com> (raw)
In-Reply-To: <20260313-libertas-usb-anchors-v1-0-915afbe988d7@igalia.com>

Serialization for the TX path was enforced by calling
usb_kill_urb()/usb_kill_anchored_urbs(), to prevent transmission before
a previous URB was completed. usb_tx_block() can be called from
interrupt context (e.g. in the HCD giveback path), so we can't always
use it to kill in-flight URBs.

Prevent sleeping during interrupt context by checking the tx_submitted
anchor for existing URBs. We now return -EBUSY, to indicate there's
a pending request.

Reported-by: syzbot+74afbb6355826ffc2239@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=74afbb6355826ffc2239
Fixes: d66676e6ca96 ("wifi: libertas: fix WARNING in usb_tx_block")
Signed-off-by: Heitor Alves de Siqueira <halves@igalia.com>
---
 drivers/net/wireless/marvell/libertas/if_usb.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/marvell/libertas/if_usb.c b/drivers/net/wireless/marvell/libertas/if_usb.c
index 11cd1422f46a..d3b9f7619a1a 100644
--- a/drivers/net/wireless/marvell/libertas/if_usb.c
+++ b/drivers/net/wireless/marvell/libertas/if_usb.c
@@ -429,7 +429,12 @@ static int usb_tx_block(struct if_usb_card *cardp, uint8_t *payload, uint16_t nb
 		goto tx_ret;
 	}
 
-	usb_kill_anchored_urbs(&cardp->tx_submitted);
+	/* check if there are pending URBs */
+	if (!usb_anchor_empty(&cardp->tx_submitted)) {
+		lbs_deb_usbd(&cardp->udev->dev, "%s failed: pending URB\n", __func__);
+		ret = -EBUSY;
+		goto tx_ret;
+	}
 
 	usb_fill_bulk_urb(cardp->tx_urb, cardp->udev,
 			  usb_sndbulkpipe(cardp->udev,

-- 
2.53.0


      parent reply	other threads:[~2026-03-13 21:28 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-13 21:27 [PATCH 0/2] wifi: libertas: add USB anchors for TX/RX paths Heitor Alves de Siqueira
2026-03-13 21:27 ` [PATCH 1/2] wifi: libertas: use USB anchors for tracking in-flight URBs Heitor Alves de Siqueira
2026-03-13 21:27 ` Heitor Alves de Siqueira [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=20260313-libertas-usb-anchors-v1-2-915afbe988d7@igalia.com \
    --to=halves@igalia.com \
    --cc=johannes.berg@intel.com \
    --cc=kernel-dev@igalia.com \
    --cc=libertas-dev@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=swilczek.lx@gmail.com \
    --cc=syzbot+74afbb6355826ffc2239@syzkaller.appspotmail.com \
    /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