summaryrefslogtreecommitdiff
path: root/firmware/target/arm
diff options
context:
space:
mode:
authorMichael Sparmann <theseven@rockbox.org>2011-11-06 00:56:26 +0000
committerMichael Sparmann <theseven@rockbox.org>2011-11-06 00:56:26 +0000
commit33d6bd61b51178b42a07a97118a689d849666331 (patch)
treecaf95a2e556f8b846b347a314e95982472cc2676 /firmware/target/arm
parent052231748f0788094ccd282a5779631b71c0b523 (diff)
downloadrockbox-33d6bd61b51178b42a07a97118a689d849666331.tar.gz
rockbox-33d6bd61b51178b42a07a97118a689d849666331.zip
usb-s3c6400x.c: Fix memory corruption bug (closes FS#12310)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30906 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target/arm')
-rw-r--r--firmware/target/arm/usb-s3c6400x.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/firmware/target/arm/usb-s3c6400x.c b/firmware/target/arm/usb-s3c6400x.c
index fbf9a4d483..af90be6944 100644
--- a/firmware/target/arm/usb-s3c6400x.c
+++ b/firmware/target/arm/usb-s3c6400x.c
@@ -48,7 +48,11 @@ struct ep_type
48} ; 48} ;
49 49
50static struct ep_type endpoints[USB_NUM_ENDPOINTS]; 50static struct ep_type endpoints[USB_NUM_ENDPOINTS];
51static struct usb_ctrlrequest ctrlreq USB_DEVBSS_ATTR; 51static union
52{
53 unsigned char data[64];
54 struct usb_ctrlrequest req;
55} ctrlreq USB_DEVBSS_ATTR;
52 56
53int usb_drv_port_speed(void) 57int usb_drv_port_speed(void)
54{ 58{
@@ -70,7 +74,7 @@ static void reset_endpoints(int reinit)
70 DOEPCTL0 = 0x8000; /* EP0 OUT ACTIVE */ 74 DOEPCTL0 = 0x8000; /* EP0 OUT ACTIVE */
71 DOEPTSIZ0 = 0x20080040; /* EP0 OUT Transfer Size: 75 DOEPTSIZ0 = 0x20080040; /* EP0 OUT Transfer Size:
72 64 Bytes, 1 Packet, 1 Setup Packet */ 76 64 Bytes, 1 Packet, 1 Setup Packet */
73 DOEPDMA0 = &ctrlreq; 77 DOEPDMA0 = &ctrlreq.data;
74 DOEPCTL0 |= 0x84000000; /* EP0 OUT ENABLE CLEARNAK */ 78 DOEPCTL0 |= 0x84000000; /* EP0 OUT ENABLE CLEARNAK */
75 if (reinit) 79 if (reinit)
76 { 80 {
@@ -243,14 +247,14 @@ void INT_USB_FUNC(void)
243 invalidate_dcache(); 247 invalidate_dcache();
244 if (i == 0) 248 if (i == 0)
245 { 249 {
246 if (ctrlreq.bRequest == 5) 250 if (ctrlreq.req.bRequest == 5)
247 { 251 {
248 /* Already set the new address here, 252 /* Already set the new address here,
249 before passing the packet to the core. 253 before passing the packet to the core.
250 See below (usb_drv_set_address) for details. */ 254 See below (usb_drv_set_address) for details. */
251 DCFG = (DCFG & ~0x7F0) | (ctrlreq.wValue << 4); 255 DCFG = (DCFG & ~0x7F0) | (ctrlreq.req.wValue << 4);
252 } 256 }
253 usb_core_control_request(&ctrlreq); 257 usb_core_control_request(&ctrlreq.req);
254 } 258 }
255 else panicf("USB: SETUP done on OUT EP%d!?", i); 259 else panicf("USB: SETUP done on OUT EP%d!?", i);
256 } 260 }
@@ -258,7 +262,7 @@ void INT_USB_FUNC(void)
258 if (!i) 262 if (!i)
259 { 263 {
260 DOEPTSIZ0 = 0x20080040; 264 DOEPTSIZ0 = 0x20080040;
261 DOEPDMA0 = &ctrlreq; 265 DOEPDMA0 = &ctrlreq.data;
262 DOEPCTL0 |= 0x84000000; 266 DOEPCTL0 |= 0x84000000;
263 } 267 }
264 DOEPINT(i) = epints; 268 DOEPINT(i) = epints;