Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp965883rwd; Tue, 13 Jun 2023 02:58:04 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6gzL6Z+CZkyIEwNkwqh7xXXLBZiWkkTWUeSy0oYbK5wHiNc3VKXMAWNJMLtVBO2rec3cMX X-Received: by 2002:a05:6a20:3d87:b0:119:94f4:c62e with SMTP id s7-20020a056a203d8700b0011994f4c62emr12001680pzi.19.1686650284288; Tue, 13 Jun 2023 02:58:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686650284; cv=none; d=google.com; s=arc-20160816; b=qmMsY0S9Cv3GTMUgJC/ikixD/T9lEIpEayzvCcQt0C9Q9SjwnRHEEa+CEI3N35hiAY /Ri04ylfeMC/q8djqPeeQu7ffQXcdQioL5Ro9dtGyxioumAz1/3UrdNfcX/171LNXe8k r6vQfpm7JhpbE0dGHCzpAF20EdsmycduPk8+hj8CHSEYj/th19PkLEC46tVwUz+13tD1 rATADigcdheAq1kTyh6g1nKI4xmcj8js3viY17F8CrLQLKMDT/aCGZNY02T4tgsjT1mT f3AkwZmJSHv+BIh8ENUWov+c+P4IHqHuwTEDVMgsR7K04ZUbkX422JSna9D4E8emepPy fONg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=f5bcGcQ8UZx4PPJn/RalkwtOEI/KNag9Gwi9lvL/rVY=; b=WJmNh+zI1LomlUYZHif/9hWZzK1lTs+CTS1/qfKq4uZnONYTK4gRdqyXyjIK0442ei DnlaNC5svSC9/wLIW8z+IQZ/vrEHVsGVsWMbud5uhOjoTL0lmNM+V96LzXoTwCiYWY71 rNnQqrYTlvKeF0QD3WUK6w7Ja7ADd8KfUnx15tMeY1kiif6NrdwrtryArhpu4WPWlPFb MBEUYvODJEPDVupviZTA6F8U7WEh3GeOz10MzhjB1W3IvEd9MDtPTIHX1xCcElq61tUw WPUCIAqd86mLeFHUOtTrUjejBRQ1Ggv8x628oR+H9gcP9OiqBC33Tt1L7pFZWElxg7w7 Ud/Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j4-20020a170903028400b001b1a240b107si8476043plr.221.2023.06.13.02.57.52; Tue, 13 Jun 2023 02:58:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240051AbjFMJog (ORCPT + 99 others); Tue, 13 Jun 2023 05:44:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58174 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233071AbjFMJof (ORCPT ); Tue, 13 Jun 2023 05:44:35 -0400 X-Greylist: delayed 902 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Tue, 13 Jun 2023 02:44:32 PDT Received: from mail.actia.se (mail.actia.se [212.181.117.226]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 103FA10DC; Tue, 13 Jun 2023 02:44:31 -0700 (PDT) Received: from W388ANL.actianordic.se (10.12.12.26) by S035ANL.actianordic.se (10.12.31.116) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Tue, 13 Jun 2023 11:29:27 +0200 From: Jonas Blixt To: , CC: , , , , Jonas Blixt Subject: [PATCH] USB: usbip: fix stub_dev hub disconnect Date: Tue, 13 Jun 2023 11:29:18 +0200 Message-ID: <20230613092918.4191895-1-jonas.blixt@actia.se> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.12.12.26] X-EsetResult: clean, is OK X-EsetId: 37303A294A191A536D766B X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If a hub is disconnected that has device(s) that's attached to the usbip layer the disconnect function might fail because it tries to release the port on an already disconnected hub. Fixes: 6080cd0e9239 ("staging: usbip: claim ports used by shared devices") Signed-off-by: Jonas Blixt --- drivers/usb/usbip/stub_dev.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/usb/usbip/stub_dev.c b/drivers/usb/usbip/stub_dev.c index 2305d425e6c9..257861787cdf 100644 --- a/drivers/usb/usbip/stub_dev.c +++ b/drivers/usb/usbip/stub_dev.c @@ -427,8 +427,12 @@ static void stub_disconnect(struct usb_device *udev) /* release port */ rc = usb_hub_release_port(udev->parent, udev->portnum, (struct usb_dev_state *) udev); - if (rc) { - dev_dbg(&udev->dev, "unable to release port\n"); + /* + * NOTE: If a HUB disconnect triggered disconnect of the down stream + * device usb_hub_release_port will return -ENODEV. + */ + if (rc && (rc != -ENODEV)) { + dev_dbg(&udev->dev, "unable to release port (%i)\n", rc); return; } -- 2.25.1