🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #5909

[PATCH net v2 2/2] net: usb: cdc_mbim: don't enable BHs in tx_fixup under netpoll

#5909
From: Nicolai Buchwitz
Date: Wed, 21 Oct 2026 07:56
41 lines
9665 bytes
cdc_mbim_tx_fixup() has the same spin_unlock_bh() as cdc_ncm_tx_fixup().
Under netpoll it runs pending softirqs while the txq lock is held, and
a transmit from one of them spins on that lock.

Use spin_lock_irqsave() as in cdc_ncm.

Fixes: 9bf211a30b3f ("net: cdc_mbim: adding MBIM driver")
Signed-off-by: Nicolai Buchwitz <nb@tipi-net.de>
---
 drivers/net/usb/cdc_mbim.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/net/usb/cdc_mbim.c b/drivers/net/usb/cdc_mbim.c
index a7010a0664c7d..7158716c1f106 100644
--- a/drivers/net/usb/cdc_mbim.c
+++ b/drivers/net/usb/cdc_mbim.c
@@ -223,6 +223,7 @@ static struct sk_buff *cdc_mbim_tx_fixup(struct usbnet *dev, struct sk_buff *skb
 	struct cdc_mbim_state *info = (void *)&dev->data;
 	struct cdc_ncm_ctx *ctx = info->ctx;
 	__le32 sign = cpu_to_le32(USB_CDC_MBIM_NDP16_IPS_SIGN);
+	unsigned long irqflags;
 	u16 tci = 0;
 	bool is_ip;
 	u8 *c;
@@ -289,9 +290,10 @@ static struct sk_buff *cdc_mbim_tx_fixup(struct usbnet *dev, struct sk_buff *skb
 		}
 	}
 
-	spin_lock_bh(&ctx->mtx);
+	/* IRQs are off and BHs on under netpoll, see cdc_ncm_tx_fixup() */
+	spin_lock_irqsave(&ctx->mtx, irqflags);
 	skb_out = cdc_ncm_fill_tx_frame(dev, skb, sign);
-	spin_unlock_bh(&ctx->mtx);
+	spin_unlock_irqrestore(&ctx->mtx, irqflags);
 	return skb_out;
 
 error:

-- 
2.53.0
Technical Details
Message-ID: <20261021-cdc-ncm-netpoll-v2-2-8818965bbb69@tipi-net.de>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-349877-linux-kernel-netdev=dewy.ru
References: <20261021-cdc-ncm-netpoll-v2-0-8818965bbb69@tipi-net.de>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-349877-linux-kernel-netdev=dewy.ru
From: nb@tipi-net.de (Nicolai Buchwitz)
Newsgroups: linux.kernel.netdev
Subject: [PATCH net v2 2/2] net: usb: cdc_mbim: don't enable BHs in
 tx_fixup under netpoll
Date: Wed, 21 Oct 2026 09:56:19 +0200
Organization: Usenet Network
Message-ID: <20261021-cdc-ncm-netpoll-v2-2-8818965bbb69@tipi-net.de>
References: <20261021-cdc-ncm-netpoll-v2-0-8818965bbb69@tipi-net.de>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 7bit
Injection-Info: usenet.network;
	logging-data="4067437"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:KmDOnmBDJOk17Qjz2rsP4u1fAa8= sha256:zn4TI0fDV33VjfnmyGUSV1l++yfM55zo1nC9R6zA5G0=
	sha1:I764xPHPkkVdH6cu0o263RUZNZI= sha256:Buhg2zRBLGlFAyWnZiwiyG6p56FJRtUvNkXFU0rndDI=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id CF5EF110F6C; Wed, 21 Oct 2026 10:57:28 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -1.95
X-Spam-Status: No, score=-1.95 tagged_above=-9999 required=6.31
	tests=[DCC_CHECK=1.1, DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1,
	DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,
	HEADER_FROM_DIFFERENT_DOMAINS=0.25, MAILING_LIST_MULTI=-1,
	RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001]
	autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=tipi-net.de
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id x-26RUbpVfNi;
	Wed, 21 Oct 2026 10:57:25 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=104.64.211.4; helo=sin.lore.kernel.org; envelope-from=netdev+bounces-349877-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=none (p=none dis=none) header.from=tipi-net.de
X-Received: from sin.lore.kernel.org (sin.lore.kernel.org [104.64.211.4])
	by mail.dewy.ru (Postfix) with ESMTPS id 7B060110F69; Wed, 21 Oct 2026 10:57:15 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sin.lore.kernel.org (Postfix) with ESMTP id 340CC2FBB8; Wed, 21 Oct 2026 07:56:50 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1792569407;
	b=f7uGgak7spqf14QeVpNpHlp/WgQDYZlHhQTwmF3ZvKNU2iGFhFIwm8GgTdpTUGsmLkCO
	 mJm3+Lkspui6JzpPSZVTcw29KNdgmR8+OkRyaU/UUVvqIw7ndJwb8Wvez+X/WJ39iLQEM
	 rChodGDcxTOUl4DVx/aFRSGHtM6rmjaaC5+BBKQQL9r+yW9MaPqUHAOoJx1oT8BV7BM++
	 +qadsrftcY/pXjSvtVSD8wig/c9G7I1SG6zE+/7H4QY2PrVOTHhrVRmqdXt25pFflm2YR
	 sIPzg92owG6xwUw4wcd5JQxB+MrXTdn3KTJWZpzt7FOhBHfR1VSSh9gwxygHiOsACvg==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1792569407;
	h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:From:
	 Date:Subject:X-Mailing-List:List-Id:List-Post:List-Help:
	 List-Subscribe:List-Unsubscribe:List-Owner:Precedence:MIME-Version:
	 Content-Type:Content-Transfer-Encoding:Message-Id:References:
	 In-Reply-To:To:Cc:X-Mailer:X-Last-TLS-Session-Version;
	bh=dd8e5Qfy/UV1GcAFvQi/X2o68cpxIAE+gjoO6DiA/KU=;
	b=L+dJ/thtmIET5FALKm9t3PwEI2j5jI4OmULssnpwYEW0YtRQm08GihrLpfe6P7lgKdjf
	 YWwZlbX8MU/EAt2uKdYAxb37mQqhSKWJSzyPqj4Y8CMWjYH1PIRXlqGeCnqTx118XBRvK
	 QV5u0nhdbzcrcbrZk0CyXU4ku0Om0QtNYBoCQc7v2J0/0LlXlYff9kRIgDYIjEB8vP7QT
	 LzxGzJ+eWZ/NoJNEVlxqcFqSC3YYLZLuICy6ugWsDQzKP5mjthgt2A1HIGGfGHheFcgmu
	 aFMZ8Z2XwDUg4kH3+MLoIxdlXs7ZXk+tfLsOXcuNG6IZihyZr5LCPaeXcYQz7R2vOAA==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=tipi-net.de header.i=@tipi-net.de header.a=rsa-sha256 header.s=dkim header.b=ucLSaO26;
	dmarc=none header.from=tipi-net.de;
	spf=pass smtp.mailfrom=tipi-net.de;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id AC49C606A32D;
	Wed, 21 Oct 2026 07:56:47 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key, unprotected) header.d=tipi-net.de header.i=@tipi-net.de header.a=rsa-sha256 header.s=dkim header.b=ucLSaO26
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=194.13.80.246
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1792569396;
	b=1rQatW4Yc4jZLFjSIVcEuxMA526L3a33bYB/Mg2ViWVub/Mo0mczRYbKRdyqQsXCaXJ9
	 4cN0tE+YAw/gaH0eeBDhy4rom4J/Aa2AHaw8YA9kVlR9eYRHvPMC/xay/WitBWkzvfTYN
	 Lq/Etj9GTa/lcb4ZZ4NgwkMtWZs9QTv2mNUWo/zbeqy43jCg+/Pz/vRc1meObgXTBL69s
	 1fHrUdXL7ODocNOoDql/a+kcC484IMaHrVzFoDOq/mzqLefVA3KlhLPgXVMNLQoiRz/Ag
	 Y0IZAXi2AfbPu0dPOQESr9nHAhW1jLSgvlzW5h3AwZUfCBzw+f8pDT2jxrOZxNrOeNQ==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1792569396;
	h=DMARC-Filter:Received:DKIM-Signature:From:Date:Subject:MIME-Version:
	 Content-Type:Content-Transfer-Encoding:Message-Id:References:
	 In-Reply-To:To:Cc:X-Mailer:X-Last-TLS-Session-Version;
	bh=dd8e5Qfy/UV1GcAFvQi/X2o68cpxIAE+gjoO6DiA/KU=;
	b=lGm4uSqwDSJd8BUun2CUNWeGk775S8Fgc3Z46EHNo/rD23A6Nzudts50HSzCiOHM+o7D
	 /uJM6+7V1tz2sXvY6BDLQBujrWTiFVJmZP2CL9IbwIg1Bjh43k/A8d+/cf1n8mxhmk2YV
	 0Tb8BCyDqfQCCcjBOgKf5B8kJBTJgRXjYj6N6DA3j250Bgp5rFqr6YBAfmrUQ31Qpqeqk
	 Z/VpZLrtdYSnTeidLKVbW1osRtJ18BXkxc5tqFm5YbfipGm1LkhQjSUf6r24jEmHy47sL
	 Hf4EhadoGN81X/DhZR1dB8WtpfVryrn/kTFcgPxseVuu+6sZcCBzxlYNfHL4xN45L7Q==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dmarc=none header.from=tipi-net.de;
	spf=pass smtp.mailfrom=tipi-net.de;
	dkim=pass header.d=tipi-net.de header.i=@tipi-net.de header.a=rsa-sha256 header.s=dkim header.b=ucLSaO26;
	arc=none smtp.remote-ip=194.13.80.246
X-Received: from mail.tipi-net.de (mail.tipi-net.de [194.13.80.246])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id C040E606A324;
	Wed, 21 Oct 2026 07:56:35 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org C040E606A324
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tipi-net.de
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=tipi-net.de
X-Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 790E5A1628;
	Wed, 21 Oct 2026 09:56:33 +0200 (CEST)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tipi-net.de; s=dkim;
	t=1792569393; h=from:subject:date:message-id:to:cc:mime-version:content-type:
	 content-transfer-encoding:in-reply-to:references;
	bh=dd8e5Qfy/UV1GcAFvQi/X2o68cpxIAE+gjoO6DiA/KU=;
	b=ucLSaO26KUGZxF11RmKIlLGramPdXPlmduVu/GlhO9rDZ/nG9BvrhlMoc+Upad3B8eiJeu
	YuYF3yM58XiOVyErz/ingLgnFkmgUYvNj1dbmHOGSWElgIODMETWNr+YO33Oh66RPeeILP
	ywBH9rmelR4qtEAtg00CElhElaI9oVr7oqyfNMsCNbOMgHFhtsZ76fZp61UwkR1gUXfbld
	e04bZQInXYUn6FiB1ZHnkKroc62KOIphAbjcB1CREVcXPnc5rtMyJDRm4X/ihbGP9ocCJn
	iBOceqGiye5XidQhSSi91z2OhibNGn+NZBJ92D9daX58TxFGilx6LsMKhpYKPw==
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list
X-In-Reply-To: <20261021-cdc-ncm-netpoll-v2-0-8818965bbb69@tipi-net.de>
X-Cc: Breno Leitao <leitao@debian.org>, linux-usb@vger.kernel.org, 
 netdev@vger.kernel.org, linux-kernel@vger.kernel.org, 
 Nicolai Buchwitz <nb@tipi-net.de>
X-Mailer: b4 0.16.0
X-Last-TLS-Session-Version: TLSv1.3