Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp840651rwd; Thu, 15 Jun 2023 02:50:42 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6Cc2FYTm75sNpTPybFeLP98Weo3aFoPvtG+yJu8OjX127TgGPkj3nw/j/LTFjpujKLAVPQ X-Received: by 2002:a05:6359:61c:b0:123:3ea3:2bd2 with SMTP id eh28-20020a056359061c00b001233ea32bd2mr9878563rwb.32.1686822642160; Thu, 15 Jun 2023 02:50:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686822642; cv=none; d=google.com; s=arc-20160816; b=lSyzVxHHCSiW7nwmV+AWGpgfjqpvU/voSPcELm+0V3ghVg3hdFFRlRF0cDcgWbsWrX igdXiqjoyCHn1PjrDEpLAWBPhCnJDpDKkKn/L44H5pjnz+6IKl5r4Zxzkq5IzdC08+XF RlvHSCVgJQ3YGeGNLbUV0KJtJeZtMZA28civh4iZUeJQz8qhc53qHoC2fGRpmdh5HwMM SkUwziOMPQiHJpyq6FpdeYRgtblBOX/GMFlM3ESbAlJQHEotoMG24ns8XY0yr9dzqzle L0nir4SfT0D81tsh2aynMwxigbz3VycNZDZEh+JvSwB/UTpOklDXHmVewrea2VmpDdWq bihQ== 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=SqNtN5KX0JrRzW27C70hM33bB26znAD6eqKPgSf7Uo8=; b=JnyXuousgiDy5uwzpoo+P/Dun4u/hQ3pyRtxoz+6N8NYfQWtxIQnz8oWmIsE+7Xcdy TxAWOVPI1NOuKuigDuL6kYXoAv9efCwAZN+w1KJyziFsYALKTiFtf0zGpq7032Q0QHwB yr+TEsidJfix0pRLZE+PHmCEPtB1OByE/4oHp6caJZmdtAbCFsydFLCHF4p/2smv5BeW W0KiwrZUp20pEV8AohWc6nDnK5E8jvrPjGwUYZWYwNB4351S36ZJAFMBw9K+9Au2d0vz HZDqUIZOFk9GRmIoqy71kI6cZ9lmgpFN4B4yikuitETY55dfEfkfQ8ESHp7ZwTSXhft1 NYHA== 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 m26-20020a638c1a000000b005346b982bd5si12579651pgd.433.2023.06.15.02.50.29; Thu, 15 Jun 2023 02:50:42 -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 S241279AbjFOJ2w (ORCPT + 99 others); Thu, 15 Jun 2023 05:28:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58960 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241440AbjFOJ2X (ORCPT ); Thu, 15 Jun 2023 05:28:23 -0400 Received: from mail.actia.se (mail.actia.se [212.181.117.226]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BAB1F199D; Thu, 15 Jun 2023 02:28:22 -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; Thu, 15 Jun 2023 11:28:21 +0200 From: Jonas Blixt To: , CC: , , , , Jonas Blixt Subject: [PATCH v2] USB: usbip: fix stub_dev hub disconnect Date: Thu, 15 Jun 2023 11:28:10 +0200 Message-ID: <20230615092810.1215490-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: 37303A294A191A536D7367 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 --- v2: - Clarify comment v1: Link to v1: https://lore.kernel.org/linux-usb/20230615092205.GA1212960@W388ANL/T/#m575e37dc404067797eadf4444857366c73ba3420 --- drivers/usb/usbip/stub_dev.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/usb/usbip/stub_dev.c b/drivers/usb/usbip/stub_dev.c index 2305d425e6c9..2170c95c8dab 100644 --- a/drivers/usb/usbip/stub_dev.c +++ b/drivers/usb/usbip/stub_dev.c @@ -427,8 +427,13 @@ 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 so we can safely ignore + * that error here. + */ + if (rc && (rc != -ENODEV)) { + dev_dbg(&udev->dev, "unable to release port (%i)\n", rc); return; } -- 2.25.1