]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
usb: dwc3: gadget: properly check ep cmd
authorFelipe Balbi <felipe.balbi@linux.intel.com>
Fri, 12 Apr 2024 20:26:05 +0000 (22:26 +0200)
committerMattijs Korpershoek <mkorpershoek@baylibre.com>
Thu, 16 May 2024 06:38:24 +0000 (08:38 +0200)
Upstream Linux commit 5999914f227b.

The cmd argument we pass to
dwc3_send_gadget_ep_cmd() could contain extra
arguments embedded. When checking for StartTransfer
command, we need to make sure to match only lower 4
bits which contain the actual command and ignore the
rest.

Reported-by: Janusz Dziedzic <januszx.dziedzic@intel.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
[A. Sverdlin: cherry-picked only DWC3_DEPCMD_CMD() define]
Signed-off-by: Alexander Sverdlin <alexander.sverdlin@siemens.com>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Link: https://lore.kernel.org/r/20240412202611.3565052-6-alexander.sverdlin@siemens.com
Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
drivers/usb/dwc3/core.h

index 4162a682298904dc4ac26810348222e4e2193a26..7374ce950da8bdb27df0c7c45277938ea2ad4204 100644 (file)
 #define DWC3_DEPCMD_SETTRANSFRESOURCE  (0x02 << 0)
 #define DWC3_DEPCMD_SETEPCONFIG                (0x01 << 0)
 
+#define DWC3_DEPCMD_CMD(x)             ((x) & 0xf)
+
 /* The EP number goes 0..31 so ep0 is always out and ep1 is always in */
 #define DWC3_DALEPENA_EP(n)            (1 << n)