patch "usb: renesas_usbhs: protect the CFIFOSEL setting in" added to usb-next
Subsystems (2)
This is a note to let you know that I've just added the patch titled
usb: renesas_usbhs: protect the CFIFOSEL setting in
to my usb git tree which can be found at
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git
in the usb-next branch.
The patch will show up in the next release of the linux-next tree (usually sometime within the next 24 hours during the week.)
The patch will also be merged in the next major kernel release during the merge window.
If you have any questions about this process, please let me know.
Quoted 1 line
From
15e4292a2d21e9997fdb2b8c014cc461b3f268f0Mon Sep 17 00:00:00 2001
From: Yoshihiro Shimoda <[email protected]>
Date: Wed, 8 Jun 2016 16:32:50 +0900
Subject: usb: renesas_usbhs: protect the CFIFOSEL setting in
usbhsg_ep_enable()
This patch fixes an issue that the CFIFOSEL register value is possible to be changed by usbhsg_ep_enable() wrongly. And then, a data transfer using CFIFO may not work correctly.
For example:
# modprobe g_multi file=usb-storage.bin # ifconfig usb0 192.168.1.1 up (During the USB host is sending file to the mass storage) # ifconfig usb0 down
In this case, since the u_ether.c may call usb_ep_enable() in eth_stop(), if the renesas_usbhs driver is also using CFIFO for mass storage, the mass storage may not work correctly.
So, this patch adds usbhs_lock() and usbhs_unlock() calling in usbhsg_ep_enable() to protect CFIFOSEL register. This is because:
- CFIFOSEL.CURPIPE = 0 is also needed for the pipe configuration
- The CFIFOSEL (fifo->sel) is already protected by usbhs_lock()
--- drivers/usb/renesas_usbhs/mod_gadget.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/usb/renesas_usbhs/mod_gadget.c +8 -1
@@ -585,6 +585,9 @@ static int usbhsg_ep_enable(struct usb_ep *ep,struct usbhs_priv *priv =usbhsg_gpriv_to_priv (gpriv);struct usbhs_pipe *pipe;int ret = -EIO ; +unsigned long flags; + +usbhs_lock (priv, flags);/* * if it already have pipe,
@@ -593,7 +596,8 @@ static int usbhsg_ep_enable(struct usb_ep *ep,if (uep->pipe) {usbhs_pipe_clear (uep->pipe);usbhs_pipe_sequence_data0 (uep->pipe); -return 0 ; + ret =0 ; + goto usbhsg_ep_enable_end; } pipe = usbhs_pipe_malloc(priv,
@@ -621,6 +625,9 @@ static int usbhsg_ep_enable(struct usb_ep *ep, ret =0 ; } +usbhsg_ep_enable_end: +usbhs_unlock (priv, flags); +return ret; }
Signature · 1 line
2.9.0