From patchwork Tue Apr 1 08:45:38 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oliver Neukum X-Patchwork-Id: 14034486 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2CCC31EB1AF for ; Tue, 1 Apr 2025 08:47:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743497274; cv=none; b=cg2NLiRJWNB5AsF1zYoPVy6UXb3RJ8p6BvfpN6ait6ILPEcIQiYxpnGkqw3Q9qFQRACDx88Fbnn1NqGwoiPWP3b9FyLMyyCbL97DCfrzAnYU7uxIoJ0mWXoHaRULfk2Js8TLVMVnnx2PzdTiiSA/XZCWgS6pW1CFPA0xnZOjP2A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743497274; c=relaxed/simple; bh=aU3au+otIKSxltUYnJ8K39yl1EqCoQKcIiDbdQBsWEc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=dQuKuzq4Vwdd2w+tFAyyGG1FKYI1oXuovZLEncFI+NmPKi3dTqeburSfszDBQol8yxwmamp6/k3ERsUF1P2Mfl4dXtb2rcXoRx9WsJwyQ/u29we3eA8tarc7WDhMfphfiAVuZ9VYCNcE8p4NUxVXBNg43QibDa5keI44cQfK7qQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com; spf=pass smtp.mailfrom=suse.com; dkim=pass (1024-bit key) header.d=suse.com header.i=@suse.com header.b=asUcIdFW; dkim=pass (1024-bit key) header.d=suse.com header.i=@suse.com header.b=asUcIdFW; arc=none smtp.client-ip=195.135.223.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.com header.i=@suse.com header.b="asUcIdFW"; dkim=pass (1024-bit key) header.d=suse.com header.i=@suse.com header.b="asUcIdFW" Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 3A1DB1F38D; Tue, 1 Apr 2025 08:47:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1743497271; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=PAWzvUvIce3uGPLV0zmT3epi+cTKOT1jtdNwIQTSGNE=; b=asUcIdFWXuRZY/jfB+paOJV5NCPHdwX4aBxnvTYQhn/nv98h76KCXGw1HHEQq5NSmJp1aS i9gc73k/WAkFUAQhr3Tcjhnbe0z94HsOfgwm+tq0ZwpwjV0u4MkzSK9WKYEHKchR8Tlt9/ Iw1lVKzqDiQMo9K5E/uVtDY8qCLM9SY= Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1743497271; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=PAWzvUvIce3uGPLV0zmT3epi+cTKOT1jtdNwIQTSGNE=; b=asUcIdFWXuRZY/jfB+paOJV5NCPHdwX4aBxnvTYQhn/nv98h76KCXGw1HHEQq5NSmJp1aS i9gc73k/WAkFUAQhr3Tcjhnbe0z94HsOfgwm+tq0ZwpwjV0u4MkzSK9WKYEHKchR8Tlt9/ Iw1lVKzqDiQMo9K5E/uVtDY8qCLM9SY= Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 0C7B913A50; Tue, 1 Apr 2025 08:47:51 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id SCTsATeo62cRcQAAD6G6ig (envelope-from ); Tue, 01 Apr 2025 08:47:51 +0000 From: Oliver Neukum To: gregkh@linuxfoundation.org, bjorn@mork.no, loic.poulain@linaro.org, linux-usb@vger.kernel.org, netdev@vger.kernel.org Cc: Oliver Neukum Subject: [PATCHv2 1/4] USB: wdm: handle IO errors in wdm_wwan_port_start Date: Tue, 1 Apr 2025 10:45:38 +0200 Message-ID: <20250401084749.175246-2-oneukum@suse.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250401084749.175246-1-oneukum@suse.com> References: <20250401084749.175246-1-oneukum@suse.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Spam-Score: -6.80 X-Spamd-Result: default: False [-6.80 / 50.00]; REPLY(-4.00)[]; BAYES_HAM(-3.00)[99.99%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MIME_TRACE(0.00)[0:+]; TO_DN_SOME(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; DKIM_SIGNED(0.00)[suse.com:s=susede1]; FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_FIVE(0.00)[6]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCVD_TLS_ALL(0.00)[] X-Spam-Flag: NO X-Spam-Level: In case submitting the URB fails we must undo what we've done so far. Fixes: cac6fb015f71 ("usb: class: cdc-wdm: WWAN framework integration") Signed-off-by: Oliver Neukum --- drivers/usb/class/cdc-wdm.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/usb/class/cdc-wdm.c b/drivers/usb/class/cdc-wdm.c index 856488a7cb6b..12038aa43942 100644 --- a/drivers/usb/class/cdc-wdm.c +++ b/drivers/usb/class/cdc-wdm.c @@ -831,6 +831,7 @@ static struct usb_class_driver wdm_class = { static int wdm_wwan_port_start(struct wwan_port *port) { struct wdm_device *desc = wwan_port_get_drvdata(port); + int rv; /* The interface is both exposed via the WWAN framework and as a * legacy usbmisc chardev. If chardev is already open, just fail @@ -850,7 +851,15 @@ static int wdm_wwan_port_start(struct wwan_port *port) wwan_port_txon(port); /* Start getting events */ - return usb_submit_urb(desc->validity, GFP_KERNEL); + rv = usb_submit_urb(desc->validity, GFP_KERNEL); + if (rv < 0) { + wwan_port_txoff(port); + desc->manage_power(desc->intf, 0); + /* this must be last lest we race with chardev open */ + clear_bit(WDM_WWAN_IN_USE, &desc->flags); + } + + return rv; } static void wdm_wwan_port_stop(struct wwan_port *port) From patchwork Tue Apr 1 08:45:39 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oliver Neukum X-Patchwork-Id: 14034488 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C80AC1EB5C9 for ; Tue, 1 Apr 2025 08:47:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743497282; cv=none; b=YYtoL/ENuQNaz76fb4ERcDohufhtr5CTVGreKnU1vUnHFpm4VDBGrtBcyEo9/weCmZZxmwQ8hlQ4Vg/puu8o5qvDgtoTbbKaX2C7pNUjV3StAS+A6NbRtBBWnn4IIJaCNWbO46P5AwSEoisRa/tQmwsivE5CrMyD3SYzwVlgni8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743497282; c=relaxed/simple; bh=UOvbgh36k7g6Wtfi8274ibUf/WShtaJAHsIC1v4bej4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Zgi9H+UVYm9FXh3aM8EXSWq6fh7H79RGafWd1dmk4GXnYlgKFTH4bh3kmYCNhvsSEl0zeXjYc/RL1Ah5ZIV5YADj0AMku9GKKHY8/wmHUx7e4F65gwlRz17/Rk9cCMqrQOKPXSigPg1hYHuLPncpn+GVC4O0WaXYjB3jo6kwJqM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com; spf=pass smtp.mailfrom=suse.com; dkim=pass (1024-bit key) header.d=suse.com header.i=@suse.com header.b=dhArXzm6; dkim=pass (1024-bit key) header.d=suse.com header.i=@suse.com header.b=dhArXzm6; arc=none smtp.client-ip=195.135.223.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.com header.i=@suse.com header.b="dhArXzm6"; dkim=pass (1024-bit key) header.d=suse.com header.i=@suse.com header.b="dhArXzm6" Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 6B0A21F38E; Tue, 1 Apr 2025 08:47:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1743497271; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=M4q1iJBZ60vR+H7kuKUrKnPh7h0YbIz5fYsxm9hBxh8=; b=dhArXzm6nLOAOr9gsYE/2Imhwfchek+ixEMCzSPxfTBKb8xxgUnzVYVp4Stb4GKenhUm1K zzyX/v4W6+WGXwrA1J18mPSPMp7KeVQr1DQi0mi2NFV9ILvzJPIn35FBHXd3JpCoI5oxuX gc5XRxcsRb5rqecG8q0ay4VZnxr9Qog= Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1743497271; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=M4q1iJBZ60vR+H7kuKUrKnPh7h0YbIz5fYsxm9hBxh8=; b=dhArXzm6nLOAOr9gsYE/2Imhwfchek+ixEMCzSPxfTBKb8xxgUnzVYVp4Stb4GKenhUm1K zzyX/v4W6+WGXwrA1J18mPSPMp7KeVQr1DQi0mi2NFV9ILvzJPIn35FBHXd3JpCoI5oxuX gc5XRxcsRb5rqecG8q0ay4VZnxr9Qog= Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 3EF8213691; Tue, 1 Apr 2025 08:47:51 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id 8LlCDjeo62cRcQAAD6G6ig (envelope-from ); Tue, 01 Apr 2025 08:47:51 +0000 From: Oliver Neukum To: gregkh@linuxfoundation.org, bjorn@mork.no, loic.poulain@linaro.org, linux-usb@vger.kernel.org, netdev@vger.kernel.org Cc: Oliver Neukum Subject: [PATCHv2 2/4] USB: wdm: close race between wdm_open and wdm_wwan_port_stop Date: Tue, 1 Apr 2025 10:45:39 +0200 Message-ID: <20250401084749.175246-3-oneukum@suse.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250401084749.175246-1-oneukum@suse.com> References: <20250401084749.175246-1-oneukum@suse.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Spam-Level: X-Spamd-Result: default: False [-6.80 / 50.00]; REPLY(-4.00)[]; BAYES_HAM(-3.00)[100.00%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MIME_TRACE(0.00)[0:+]; TO_DN_SOME(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; DKIM_SIGNED(0.00)[suse.com:s=susede1]; FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_FIVE(0.00)[6]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCVD_TLS_ALL(0.00)[] X-Spam-Score: -6.80 X-Spam-Flag: NO Clearing WDM_WWAN_IN_USE must be the last action or we can open a chardev whose URBs are still poisoned V2: added memory barriers Fixes: cac6fb015f71 ("usb: class: cdc-wdm: WWAN framework integration") Signed-off-by: Oliver Neukum --- drivers/usb/class/cdc-wdm.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/usb/class/cdc-wdm.c b/drivers/usb/class/cdc-wdm.c index 12038aa43942..355627982343 100644 --- a/drivers/usb/class/cdc-wdm.c +++ b/drivers/usb/class/cdc-wdm.c @@ -728,7 +728,7 @@ static int wdm_open(struct inode *inode, struct file *file) rv = -EBUSY; goto out; } - + smp_rmb(); /* ordered against wdm_wwan_port_stop() */ rv = usb_autopm_get_interface(desc->intf); if (rv < 0) { dev_err(&desc->intf->dev, "Error autopm - %d\n", rv); @@ -870,8 +870,10 @@ 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); + smp_wmb(); /* ordered against wdm_open() */ + /* 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) From patchwork Tue Apr 1 08:45:40 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oliver Neukum X-Patchwork-Id: 14034487 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 347271EBA0C for ; Tue, 1 Apr 2025 08:47:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.130 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743497280; cv=none; b=Z/jPGxHTO802rL1cCzPkLSOUKjqtBuHUxeyGPrvn2GQqhT3opUGxFgNTgb5ZxeM2oxTDNowov+fqOtYGufsCgI+/RmEsJjNHcFzTMIOYroVinbOdKIPuBDLnM/BnmmgsGpfmKTDfxsGqVNeaytpjd+PTxpVXMviVzKnRjePayzU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743497280; c=relaxed/simple; bh=YGcbHkt9eFpSEQOn+JlWmpSRXYfydlDZmE8XHbwBf3I=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=d/R4ubfR06mZdW0QmN2Jx7TN6RU3VNAw2+sepvlHCz//0xdjtyRP1UutaZkBbbJLcmTdA/FZURcLl/9pqLaB2wO3jU0VirEc5YXnIk2zHIOXyc5n4VlDWbxKL59ZfJx3Ci27NLjr8TQZZ9innlnuUdw/7gQ3a3AUby8quykd48g= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com; spf=pass smtp.mailfrom=suse.com; dkim=pass (1024-bit key) header.d=suse.com header.i=@suse.com header.b=k37MAJKZ; dkim=pass (1024-bit key) header.d=suse.com header.i=@suse.com header.b=k37MAJKZ; arc=none smtp.client-ip=195.135.223.130 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.com header.i=@suse.com header.b="k37MAJKZ"; dkim=pass (1024-bit key) header.d=suse.com header.i=@suse.com header.b="k37MAJKZ" Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 9A892211E8; Tue, 1 Apr 2025 08:47:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1743497271; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=vojwZpSclVawxe5kq+1eROdzfpvhdcPhUWVb2RnGyOU=; b=k37MAJKZ+dFnP2uOPfvM6EdsWx4N7JQ9/M39bCdN0Jmk+iqnZlTMJI8WsjFpxBg24C0HW4 IzEUVLX9XL72WIoAl1ZijAA6wj0kV/yfP3DlNbvOEgNQ86rl9jhtxWlP3gknUVqpHjJ+Qz +FDmoXyq+B99aN9gqMpDb/Tl3XClq1o= Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1743497271; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=vojwZpSclVawxe5kq+1eROdzfpvhdcPhUWVb2RnGyOU=; b=k37MAJKZ+dFnP2uOPfvM6EdsWx4N7JQ9/M39bCdN0Jmk+iqnZlTMJI8WsjFpxBg24C0HW4 IzEUVLX9XL72WIoAl1ZijAA6wj0kV/yfP3DlNbvOEgNQ86rl9jhtxWlP3gknUVqpHjJ+Qz +FDmoXyq+B99aN9gqMpDb/Tl3XClq1o= Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 7071713A50; Tue, 1 Apr 2025 08:47:51 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id oHVNGjeo62cRcQAAD6G6ig (envelope-from ); Tue, 01 Apr 2025 08:47:51 +0000 From: Oliver Neukum To: gregkh@linuxfoundation.org, bjorn@mork.no, loic.poulain@linaro.org, linux-usb@vger.kernel.org, netdev@vger.kernel.org Cc: Oliver Neukum Subject: [PATCHv2 3/4] USB: wdm: wdm_wwan_port_tx_complete mutex in atomic context Date: Tue, 1 Apr 2025 10:45:40 +0200 Message-ID: <20250401084749.175246-4-oneukum@suse.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250401084749.175246-1-oneukum@suse.com> References: <20250401084749.175246-1-oneukum@suse.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Spam-Score: -6.80 X-Spamd-Result: default: False [-6.80 / 50.00]; REPLY(-4.00)[]; BAYES_HAM(-3.00)[99.99%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MIME_TRACE(0.00)[0:+]; TO_DN_SOME(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; DKIM_SIGNED(0.00)[suse.com:s=susede1]; FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_FIVE(0.00)[6]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCVD_TLS_ALL(0.00)[] X-Spam-Flag: NO X-Spam-Level: wdm_wwan_port_tx_complete is called from a completion handler with irqs disabled and possible in IRQ context usb_autopm_put_interface can take a mutex. Hence usb_autopm_put_interface_async must be used. Fixes: cac6fb015f71 ("usb: class: cdc-wdm: WWAN framework integration") Signed-off-by: Oliver Neukum --- drivers/usb/class/cdc-wdm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/class/cdc-wdm.c b/drivers/usb/class/cdc-wdm.c index 355627982343..8b99db506b71 100644 --- a/drivers/usb/class/cdc-wdm.c +++ b/drivers/usb/class/cdc-wdm.c @@ -881,7 +881,7 @@ static void wdm_wwan_port_tx_complete(struct urb *urb) struct sk_buff *skb = urb->context; struct wdm_device *desc = skb_shinfo(skb)->destructor_arg; - usb_autopm_put_interface(desc->intf); + usb_autopm_put_interface_async(desc->intf); wwan_port_txon(desc->wwanp); kfree_skb(skb); } From patchwork Tue Apr 1 08:45:41 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oliver Neukum X-Patchwork-Id: 14034489 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 46CB01EB5CD for ; Tue, 1 Apr 2025 08:48:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743497288; cv=none; b=gcI27d8/bFERYEp0N7MSvOcXMAquOibY6umF/VcgIJkFZ5tK2Oh419lesQjj4U6VNK/Iu+PK5BXjfSn1sKy+NI9fdRuxCZSxfnSZlQCGdFZGPHihBnaPLSU2Cno+lIER36jAnQdVNo0zxis+VaNk6aco1Lq6atLa3OMPLPOIHrc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743497288; c=relaxed/simple; bh=cpTAyHqjQvWCmMiwfjUNvv7XfUupoy/wYj/US+dD7QE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=izNpL/UI5g7CpoQzoRGmTLeWzSdTF287MlSBBMVGUK9CSHJDraLSZyZCAgFGhl2ty5n/laOCitfSQ65VamjGZZWWXehYfLRDtcDSTAilnBygKWfaqxO8SV56Usddv1eMmJvYDQvi8/ykh6NGS75bYYW8K8Al9DVKz69wLXkOQSA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com; spf=pass smtp.mailfrom=suse.com; dkim=pass (1024-bit key) header.d=suse.com header.i=@suse.com header.b=fvT8JSmi; dkim=pass (1024-bit key) header.d=suse.com header.i=@suse.com header.b=fvT8JSmi; arc=none smtp.client-ip=195.135.223.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.com header.i=@suse.com header.b="fvT8JSmi"; dkim=pass (1024-bit key) header.d=suse.com header.i=@suse.com header.b="fvT8JSmi" Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id D4CC41F391; Tue, 1 Apr 2025 08:47:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1743497271; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=nvbVPKtcp5y3ocnBZksieUB/EW50VUkcDueS+Szze4U=; b=fvT8JSmis1o7Y5brA92zgGX8BFH8orUBN/ow49L6aCz42GHh7n15ojtXQX1AO0wK/9P7UE pI6U7Wovvfg6JapH2CyGagQCxbl5jBxYHs+g6E0Sla2npHVenzuLNjSssmFo9QoQMcw46U 8e7/dqSLmeaGYWS2DXYQjeG/yWU5XEw= Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1743497271; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=nvbVPKtcp5y3ocnBZksieUB/EW50VUkcDueS+Szze4U=; b=fvT8JSmis1o7Y5brA92zgGX8BFH8orUBN/ow49L6aCz42GHh7n15ojtXQX1AO0wK/9P7UE pI6U7Wovvfg6JapH2CyGagQCxbl5jBxYHs+g6E0Sla2npHVenzuLNjSssmFo9QoQMcw46U 8e7/dqSLmeaGYWS2DXYQjeG/yWU5XEw= Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 9F9BE13691; Tue, 1 Apr 2025 08:47:51 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id mAHhJTeo62cRcQAAD6G6ig (envelope-from ); Tue, 01 Apr 2025 08:47:51 +0000 From: Oliver Neukum To: gregkh@linuxfoundation.org, bjorn@mork.no, loic.poulain@linaro.org, linux-usb@vger.kernel.org, netdev@vger.kernel.org Cc: Oliver Neukum Subject: [PATCHv2 4/4] USB: wdm: add annotation Date: Tue, 1 Apr 2025 10:45:41 +0200 Message-ID: <20250401084749.175246-5-oneukum@suse.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250401084749.175246-1-oneukum@suse.com> References: <20250401084749.175246-1-oneukum@suse.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Spam-Level: X-Spamd-Result: default: False [-6.80 / 50.00]; REPLY(-4.00)[]; BAYES_HAM(-3.00)[99.99%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; RCVD_COUNT_TWO(0.00)[2]; FROM_HAS_DN(0.00)[]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; R_RATELIMIT(0.00)[to_ip_from(RLikj1p7yq1njapebq4rcw7c5p)]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo]; FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; DKIM_SIGNED(0.00)[suse.com:s=susede1]; RCPT_COUNT_FIVE(0.00)[6]; RCVD_TLS_ALL(0.00)[] X-Spam-Score: -6.80 X-Spam-Flag: NO This is not understandable without a comment on endianness Fixes: afba937e540c9 ("USB: CDC WDM driver") Signed-off-by: Oliver Neukum --- drivers/usb/class/cdc-wdm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/class/cdc-wdm.c b/drivers/usb/class/cdc-wdm.c index 8b99db506b71..840cf45b791e 100644 --- a/drivers/usb/class/cdc-wdm.c +++ b/drivers/usb/class/cdc-wdm.c @@ -911,7 +911,7 @@ static int wdm_wwan_port_tx(struct wwan_port *port, struct sk_buff *skb) req->bRequestType = (USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_INTERFACE); req->bRequest = USB_CDC_SEND_ENCAPSULATED_COMMAND; req->wValue = 0; - req->wIndex = desc->inum; + req->wIndex = desc->inum; /* already converted */ req->wLength = cpu_to_le16(skb->len); skb_shinfo(skb)->destructor_arg = desc;