From: Shuah Khan <skhan@linuxfoundation.org>
To: "M. Vefa Bicakci" <m.v.b@runbox.com>, linux-usb@vger.kernel.org
Cc: Andrey Konovalov <andreyknvl@google.com>,
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 3/3] usbip: Make the driver's match function specific
Date: Thu, 17 Sep 2020 09:21:06 -0600 [thread overview]
Message-ID: <45badff8-53e9-359d-4bf2-b0f71b910b2f@linuxfoundation.org> (raw)
In-Reply-To: <20200917144151.355848-3-m.v.b@runbox.com>
On 9/17/20 8:41 AM, M. Vefa Bicakci wrote:
> Prior to this commit, the USB-IP subsystem's USB device driver match
> function used to match all USB devices (by returning true
> unconditionally). Unfortunately, this is not correct behaviour and is
> likely the root cause of the bug reported by Andrey Konovalov.
>
> USB-IP should only match USB devices that the user-space asked the kernel
> to handle via USB-IP, by writing to the match_busid sysfs file, which is
> what this commit aims to achieve. This is done by making the match
> function check that the passed in USB device was indeed requested by the
> user-space to be handled by USB-IP.
>
I see two patches 2/2 and 3/3 back to back. What is the difference
between 2/2 and 3/3 versions? They look identical. Please include
changes if any from version to version to make it easier for me to
review.
> Reported-by: Andrey Konovalov <andreyknvl@google.com>
> Fixes: 7a2f2974f2 ("usbip: Implement a match function to fix usbip")
> Link: https://lore.kernel.org/linux-usb/CAAeHK+zOrHnxjRFs=OE8T=O9208B9HP_oo8RZpyVOZ9AJ54pAA@mail.gmail.com/
> 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>
> ---
> drivers/usb/usbip/stub_dev.c | 15 ++++++++++++++-
> 1 file changed, 14 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/usb/usbip/stub_dev.c b/drivers/usb/usbip/stub_dev.c
> index 9d7d642022d1..3d9c8ff6762e 100644
> --- a/drivers/usb/usbip/stub_dev.c
> +++ b/drivers/usb/usbip/stub_dev.c
> @@ -463,7 +463,20 @@ static void stub_disconnect(struct usb_device *udev)
>
> static bool usbip_match(struct usb_device *udev)
> {
> - return true;
> + bool match;
> + struct bus_id_priv *busid_priv;
> + const char *udev_busid = dev_name(&udev->dev);
> +
> + busid_priv = get_busid_priv(udev_busid);
> + if (!busid_priv)
> + return false;
> +
> + match = (busid_priv->status != STUB_BUSID_REMOV &&
> + busid_priv->status != STUB_BUSID_OTHER);
> +
> + put_busid_priv(busid_priv);
> +
> + return match;
> }
>
> #ifdef CONFIG_PM
>
Did you happen to run the usbip test on this patch? If not, can you
please run tools/testing/selftests/drivers/usb/usbip/usbip_test.sh
and make sure there are no regressions.
thanks,
-- Shuah
next prev parent reply other threads:[~2020-09-17 15:41 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-16 13:33 USB driver ID matching broken Andrey Konovalov
2020-09-16 14:15 ` Greg Kroah-Hartman
2020-09-16 14:39 ` Bastien Nocera
2020-09-16 15:58 ` M. Vefa Bicakci
2020-09-17 9:59 ` [PATCH 1/2] usbcore/driver: Fix specific driver selection M. Vefa Bicakci
2020-09-17 9:59 ` [PATCH 2/2] usbip: Make the driver's match function specific M. Vefa Bicakci
2020-09-17 10:23 ` [PATCH 1/2] usbcore/driver: Fix specific driver selection Bastien Nocera
2020-09-17 10:39 ` M. Vefa Bicakci
2020-09-17 10:49 ` Bastien Nocera
2020-09-17 14:41 ` [PATCH 1/3] " M. Vefa Bicakci
2020-09-17 14:41 ` [PATCH 2/3] usbcore/driver: Fix incorrect downcast M. Vefa Bicakci
2020-09-17 15:01 ` Alan Stern
2020-09-18 9:26 ` M. Vefa Bicakci
2020-09-17 14:41 ` [PATCH 3/3] usbip: Make the driver's match function specific M. Vefa Bicakci
2020-09-17 15:21 ` Shuah Khan [this message]
2020-09-18 9:26 ` M. Vefa Bicakci
2020-09-18 14:31 ` M. Vefa Bicakci
2020-09-18 15:49 ` Shuah Khan
2020-09-19 13:54 ` M. Vefa Bicakci
2020-09-21 17:03 ` M. Vefa Bicakci
2020-09-18 14:31 ` [PATCH 1/3] usbcore/driver: Fix specific driver selection M. Vefa Bicakci
2020-09-18 14:52 ` Alan Stern
2020-09-19 13:52 ` M. Vefa Bicakci
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=45badff8-53e9-359d-4bf2-b0f71b910b2f@linuxfoundation.org \
--to=skhan@linuxfoundation.org \
--cc=andreyknvl@google.com \
--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