Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp784901imm; Mon, 21 May 2018 14:23:54 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqdlnZ2nNNB1xdVQKNALzpGh6ZasyVEKv8rn/NRVJUgs5zIOgegofG9ZxKNdvhl6J+MkUHU X-Received: by 2002:a17:902:3001:: with SMTP id u1-v6mr21977220plb.376.1526937834734; Mon, 21 May 2018 14:23:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526937834; cv=none; d=google.com; s=arc-20160816; b=H58MUcMI+oP/Gl2v1IJfdk194DpE8Txm15/SNd3vkk3nXJwBGIvGnfVaVFSlCu3tRG dMwyY/l5exdB+qur+VSXm9CKlOn1YV8ZDLP1o1jj8PlfcNKri5uWVTGlOnJqyidzNz05 C17dk+9vOl9JhoGsd0S7UMyPxJoOeT24o5q1WcirFC3JEFNBy2/dIxUoI9s2o3EKgduG 71wepod0UkBPmy6DyY35r4EVllOjqf0uAGenwnZrG5aVWfeeJqsVMLCcLtxP7Bl7EANc zeZWJUKjKCzITtpFZS8e3A6uOj7QMP8hei5ZKt9/ZEo4gtk1hMoNWYKYXBfSG0Cmg+LH k5YA== 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=HocnZaxKl28O52yXCF3zY0vJAKpMDfU1Pkdy2gHPv6k=; b=xWZW/Kom0av7eOsjf/QIi4vbKL+/TkwDhMhO9kkYPKUib95C7atgUvHONf//2vCLEN qbKjuILIQiAav9E4CWjAmfqAZSyC+GqO4ITMlR9Isn4VeKxjZ6cbU+04ExaIl5wuJngW KmpyZATgQAHdti+O1t8xElnLB/JPo/w4zcMblrRBdFtv/SrBH3vyLbooRvsJ3PwtSYKh a8z8l3gSmu1zJTdNHVaxqWPDlWjlL3R2dJUp7ew/KBf0s6zopIkkYGsHTfKBE5EeJf/9 O3Ca9kTgw0b4aZi8XvG+VI4+PVqWap7Jx7Az1IN7i/w8X4x4FxEhS+jTfkrEHwp6gJVT tdHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=dAvruYnQ; 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 l12-v6si11944696pgr.367.2018.05.21.14.23.40; Mon, 21 May 2018 14:23:54 -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=dAvruYnQ; 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 S1754330AbeEUVXU (ORCPT + 99 others); Mon, 21 May 2018 17:23:20 -0400 Received: from mail.kernel.org ([198.145.29.99]:38126 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932133AbeEUVXQ (ORCPT ); Mon, 21 May 2018 17:23:16 -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 71E5F20853; Mon, 21 May 2018 21:23:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1526937796; bh=sbmBMpMdtZlYHs8g/ZasTcTtxI1IdeVPzZFgTyWu9Qk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dAvruYnQWnx521A+9n86fX3Khac3FBj1KtVOzR9Izl30J0OFjq9e/KDu8u92jZhyy 7qpVFy2UfD4Wxf31m5tDno91k9L3dQkq25ward9uNVLLobZ37Lkw0//xtHz7mcQQdu VloyH0mXfesSakDyr8MZichfE+9SYilNuZio9mb4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Shuah Khan (Samsung OSG)" Subject: [PATCH 4.16 003/110] usbip: usbip_host: delete device from busid_table after rebind Date: Mon, 21 May 2018 23:11:00 +0200 Message-Id: <20180521210504.136082974@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180521210503.823249477@linuxfoundation.org> References: <20180521210503.823249477@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 4.16-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 @@ -186,6 +186,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); @@ -197,6 +200,9 @@ static ssize_t rebind_store(struct devic return ret; } + /* delete device from busid_table */ + del_match_busid((char *) buf); + return count; }