linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Shuah Khan <skhan@linuxfoundation.org>
To: "M. Vefa Bicakci" <m.v.b@runbox.com>, linux-usb@vger.kernel.org
Cc: stable@vger.kernel.org, Bastien Nocera <hadess@hadess.net>,
	Valentina Manea <valentina.manea.m@gmail.com>,
	Shuah Khan <shuah@kernel.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Alan Stern <stern@rowland.harvard.edu>,
	syzkaller@googlegroups.com,
	Shuah Khan <skhan@linuxfoundation.org>
Subject: Re: [PATCH v3 1/4] Revert "usbip: Implement a match function to fix usbip"
Date: Tue, 22 Sep 2020 17:03:15 -0600	[thread overview]
Message-ID: <a1f72e70-6eb2-743b-fc5b-f7e09ec466ce@linuxfoundation.org> (raw)
In-Reply-To: <20200922110703.720960-2-m.v.b@runbox.com>

On 9/22/20 5:07 AM, M. Vefa Bicakci wrote:
> This commit reverts commit 7a2f2974f265 ("usbip: Implement a match
> function to fix usbip").
> 
> In summary, commit d5643d2249b2 ("USB: Fix device driver race")
> inadvertently broke usbip functionality, which I resolved in an incorrect
> manner by introducing a match function to usbip, usbip_match(), that
> unconditionally returns true.
> 
> However, the usbip_match function, as is, causes usbip to take over
> virtual devices used by syzkaller for USB fuzzing, which is a regression
> reported by Andrey Konovalov.
> 
> Furthermore, in conjunction with the fix of another bug, handled by another
> patch titled "usbcore/driver: Fix specific driver selection" in this patch
> set, the usbip_match function causes unexpected USB subsystem behaviour
> when the usbip_host driver is loaded. The unexpected behaviour can be
> qualified as follows:
> - If commit 41160802ab8e ("USB: Simplify USB ID table match") is included
>    in the kernel, then all USB devices are bound to the usbip_host
>    driver, which appears to the user as if all USB devices were
>    disconnected.
> - If the same commit (41160802ab8e) is not in the kernel (as is the case
>    with v5.8.10) then all USB devices are re-probed and re-bound to their
>    original device drivers, which appears to the user as a disconnection
>    and re-connection of USB devices.
> 
> Please note that this commit will make usbip non-operational again,
> until yet another patch in this patch set is merged, titled
> "usbcore/driver: Accommodate usbip".
> 
> Reported-by: Andrey Konovalov <andreyknvl@google.com>
> Link: https://lore.kernel.org/linux-usb/CAAeHK+zOrHnxjRFs=OE8T=O9208B9HP_oo8RZpyVOZ9AJ54pAA@mail.gmail.com/
> Cc: <stable@vger.kernel.org> # 5.8: 41160802ab8e: USB: Simplify USB ID table match
> Cc: <stable@vger.kernel.org> # 5.8
> Cc: Bastien Nocera <hadess@hadess.net>
> Cc: Valentina Manea <valentina.manea.m@gmail.com>
> Cc: Shuah Khan <shuah@kernel.org>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: Alan Stern <stern@rowland.harvard.edu>
> Cc: <syzkaller@googlegroups.com>
> Signed-off-by: M. Vefa Bicakci <m.v.b@runbox.com>
> 
> ---
> v3: New patch in the patch set.
> 
>      Note for stable tree maintainers: I have marked the following commit
>      as a dependency of this patch, because that commit resolves a bug that
>      the next commit in this patch set uncovers, where if a driver does
>      not have an id_table, then its match function is not considered for
>      execution at all.
>        commit 41160802ab8e ("USB: Simplify USB ID table match")
> ---
>   drivers/usb/usbip/stub_dev.c | 6 ------
>   1 file changed, 6 deletions(-)
> 
> diff --git a/drivers/usb/usbip/stub_dev.c b/drivers/usb/usbip/stub_dev.c
> index 9d7d642022d1..2305d425e6c9 100644
> --- a/drivers/usb/usbip/stub_dev.c
> +++ b/drivers/usb/usbip/stub_dev.c
> @@ -461,11 +461,6 @@ static void stub_disconnect(struct usb_device *udev)
>   	return;
>   }
>   
> -static bool usbip_match(struct usb_device *udev)
> -{
> -	return true;
> -}
> -
>   #ifdef CONFIG_PM
>   
>   /* These functions need usb_port_suspend and usb_port_resume,
> @@ -491,7 +486,6 @@ struct usb_device_driver stub_driver = {
>   	.name		= "usbip-host",
>   	.probe		= stub_probe,
>   	.disconnect	= stub_disconnect,
> -	.match		= usbip_match,
>   #ifdef CONFIG_PM
>   	.suspend	= stub_suspend,
>   	.resume		= stub_resume,
> 

Thank you for finding a solution that works for usbip

Acked-by: Shuah Khan <skhan@linuxfoundation.org>

thanks,
-- Shuah

  reply	other threads:[~2020-09-22 23:03 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-22 11:06 [PATCH v3 0/4] Fixes for usbip and specialised USB driver selection M. Vefa Bicakci
2020-09-22 11:07 ` [PATCH v3 1/4] Revert "usbip: Implement a match function to fix usbip" M. Vefa Bicakci
2020-09-22 23:03   ` Shuah Khan [this message]
2020-09-22 11:07 ` [PATCH v3 2/4] usbcore/driver: Fix specific driver selection M. Vefa Bicakci
2020-09-22 11:07 ` [PATCH v3 3/4] usbcore/driver: Fix incorrect downcast M. Vefa Bicakci
2020-09-25 14:51   ` Greg Kroah-Hartman
2020-09-25 16:31     ` M. Vefa Bicakci
2020-09-26  5:37       ` Greg Kroah-Hartman
2020-09-22 11:07 ` [PATCH v3 4/4] usbcore/driver: Accommodate usbip M. Vefa Bicakci
2020-09-22 23:04   ` Shuah Khan
2020-09-23  6:08     ` M. Vefa Bicakci
2020-09-22 12:38 ` [PATCH v3 0/4] Fixes for usbip and specialised USB driver selection Andrey Konovalov
2020-09-22 12:52   ` M. Vefa Bicakci
2020-10-02  3:11 ` Brooke Basile
2020-10-02  9:00   ` M. Vefa Bicakci
2020-10-02  9:05     ` Brooke Basile

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a1f72e70-6eb2-743b-fc5b-f7e09ec466ce@linuxfoundation.org \
    --to=skhan@linuxfoundation.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=hadess@hadess.net \
    --cc=linux-usb@vger.kernel.org \
    --cc=m.v.b@runbox.com \
    --cc=shuah@kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=stern@rowland.harvard.edu \
    --cc=syzkaller@googlegroups.com \
    --cc=valentina.manea.m@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).