Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp2060488imm; Thu, 24 May 2018 05:14:39 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoLP7rreaH8idYlTgBV86eQUnvdbC+PA0h/uaVYz15EdJPegLnYz1xnjxcTAoJwhhV5rqaW X-Received: by 2002:a63:5f0b:: with SMTP id t11-v6mr4379422pgb.79.1527164079377; Thu, 24 May 2018 05:14:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527164079; cv=none; d=google.com; s=arc-20160816; b=nmYuS1ZmBdxnJG+bGUhVIFs2mUHfUhBEK9P+/PvN1u6Fd6iselhRmqjZrLb4rLlpgf ctrjrJE692am0xJlhFXafBuB2IGVo4Qk5v8OfQmkHf/9Z8k89Sq87JKKaI1ikWnu765c VkTnQ7N4ECI3JZBVdeEgZW+JDWMQCPoremORxKqinZ4YJjhJCKwX8+/engAe6MCNRiSK OKIsDnFwWDJzqhctpyy+18BZI1Dw37IcTHFhsiKnlCuw2BDH/LXeLyOyPLfS/Ypd8nzj WyqbXzbCgvXlFn3fTyig1Io+iWdNI2s4v64wUglYcxivJyLeFUMkqAJl+ikdf6kDd+X6 EIfw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=X9xmIvPedLr5PaVdlOVW2IrBsbWaqxnw+CVQ4+0aJ+0=; b=vzi14AOzFZp83jwgzH8S6C6i2aR0kYpiEZu3SICxoE6Gl5V87Bj/5CX2hyuiuWzLbj dLngf7MochAJFUkFGar/TGfvjrnAjObw4eNNl5OmCbS+YcpRDoyKidNmFcMY7ccEBvhA TN0bBNpUwi2b58wVul4Bx4gv6y7VyfwawhgPtvgyUCoF5u1eAKOxq29lgYJZMWgozunA EsKKNarj+nZcACOec4egybAZ8Vm+JmbTOPk7/aoxmT0Ylpg8xFP/Q1v7jmJOzup5VJnY o/s9cfywCunLuVqBmB1aTkE47fbItcYvskJofVYwtz71o/RYeWf14JZ1WAP6LWp0uU2J V+Qg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=L98vx8og; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v6-v6si21932020plp.60.2018.05.24.05.14.19; Thu, 24 May 2018 05:14:39 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=L98vx8og; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S969804AbeEXMNi (ORCPT + 99 others); Thu, 24 May 2018 08:13:38 -0400 Received: from mail.kernel.org ([198.145.29.99]:54320 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966031AbeEXJmm (ORCPT ); Thu, 24 May 2018 05:42:42 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 8FEAF20893; Thu, 24 May 2018 09:42:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1527154961; bh=o598jKrBjcLKimp/Ol1CJdyMhRBDZzR3w82kCvj/RAk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=L98vx8ogRW/q4UfJNHiUJZJmbckHkniRbquzcd35mwEW4sqcaK9amOjfpdgaTD/5D ERYg7wtJJFeaB+yt4A0U272LjYEDLBwh47W4lZJ1cX/TvxKeXYEtvA6pefPrcmAceV Ea0SuomfjukzU4A14wdrNEA/FCZyStkeoYaeE19g= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Shuah Khan (Samsung OSG)" Subject: [PATCH 3.18 24/45] usbip: usbip_host: delete device from busid_table after rebind Date: Thu, 24 May 2018 11:38:32 +0200 Message-Id: <20180524093123.749172171@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180524093120.599252450@linuxfoundation.org> References: <20180524093120.599252450@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Shuah Khan (Samsung OSG) commit 1e180f167d4e413afccbbb4a421b48b2de832549 upstream. Device is left in the busid_table after unbind and rebind. Rebind initiates usb bus scan and the original driver claims the device. After rescan the device should be deleted from the busid_table as it no longer belongs to usbip_host. Fix it to delete the device after device_attach() succeeds. Signed-off-by: Shuah Khan (Samsung OSG) Cc: stable Signed-off-by: Greg Kroah-Hartman --- drivers/usb/usbip/stub_main.c | 6 ++++++ 1 file changed, 6 insertions(+) --- a/drivers/usb/usbip/stub_main.c +++ b/drivers/usb/usbip/stub_main.c @@ -201,6 +201,9 @@ static ssize_t rebind_store(struct devic if (!bid) return -ENODEV; + /* mark the device for deletion so probe ignores it during rescan */ + bid->status = STUB_BUSID_OTHER; + /* device_attach() callers should hold parent lock for USB */ if (bid->udev->dev.parent) device_lock(bid->udev->dev.parent); @@ -212,6 +215,9 @@ static ssize_t rebind_store(struct devic return ret; } + /* delete device from busid_table */ + del_match_busid((char *) buf); + return count; }