Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

USB: trancevibrator: fix control-request direction

The direction of the pipe argument must match the request-type direction
bit or control requests may fail depending on the host-controller-driver
implementation.

Fix the set-speed request which erroneously used USB_DIR_IN and update
the default timeout argument to match (same value).

Fixes: 5638e4d92e77 ("USB: add PlayStation 2 Trance Vibrator driver")
Cc: stable@vger.kernel.org # 2.6.19
Signed-off-by: Johan Hovold <johan@kernel.org>
Link: https://lore.kernel.org/r/20210521133109.17396-1-johan@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Johan Hovold and committed by
Greg Kroah-Hartman
746e4acf 6a4c8f60

+2 -2
+2 -2
drivers/usb/misc/trancevibrator.c
··· 61 61 /* Set speed */ 62 62 retval = usb_control_msg(tv->udev, usb_sndctrlpipe(tv->udev, 0), 63 63 0x01, /* vendor request: set speed */ 64 - USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_OTHER, 64 + USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_OTHER, 65 65 tv->speed, /* speed value */ 66 - 0, NULL, 0, USB_CTRL_GET_TIMEOUT); 66 + 0, NULL, 0, USB_CTRL_SET_TIMEOUT); 67 67 if (retval) { 68 68 tv->speed = old; 69 69 dev_dbg(&tv->udev->dev, "retval = %d\n", retval);