Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a81d6b73 authored by Felipe Balbi's avatar Felipe Balbi Committed by Sriharsha Allenki
Browse files

usb: dwc3: gadget: properly check ep cmd



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: default avatarJanusz Dziedzic <januszx.dziedzic@intel.com>
Signed-off-by: default avatarFelipe Balbi <felipe.balbi@linux.intel.com>
Git-commit: 5999914f227b20addf01297b3df24be6b4161f69
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git


Signed-off-by: default avatarSriharsha Allenki <sallenki@codeaurora.org>
Change-Id: Id6c1f63fc9f4ce312b4be0712c57e3cd22295eab
parent 0bbf24ae
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -480,6 +480,8 @@
#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)

+1 −1
Original line number Diff line number Diff line
@@ -355,7 +355,7 @@ int dwc3_send_gadget_ep_cmd(struct dwc3_ep *dep, unsigned cmd,
		}
	}

	if (cmd == DWC3_DEPCMD_STARTTRANSFER) {
	if (DWC3_DEPCMD_CMD(cmd) == DWC3_DEPCMD_STARTTRANSFER) {
		int		needs_wakeup;

		needs_wakeup = (dwc->link_state == DWC3_LINK_STATE_U1 ||