diff options
author | David Brownell <david-b@pacbell.net> | 2007-12-10 01:53:09 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2008-02-01 17:34:59 -0500 |
commit | 1440e0967de8c598dae96d741652d498b3eb8f27 (patch) | |
tree | c00b72257474bbdf10d16f598d7c3e836eba65c6 /drivers/usb/gadget/at91_udc.c | |
parent | e58679805dab3fb75df88141d9d869904a93337f (diff) |
USB: gadget: at91_udc minor fix (there is no number six)
Fix a small glitch noted by Yannick Cote. There is no endpoint number
six, so if a (broken) host wrongly tried to change or read status of
that endpoint, the driver could access reserved register space.
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Cc: Yannick Cote <yanick@yanos.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/gadget/at91_udc.c')
-rw-r--r-- | drivers/usb/gadget/at91_udc.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/usb/gadget/at91_udc.c b/drivers/usb/gadget/at91_udc.c index 4b6ed353ae36..305db36a3b1c 100644 --- a/drivers/usb/gadget/at91_udc.c +++ b/drivers/usb/gadget/at91_udc.c | |||
@@ -1153,7 +1153,7 @@ static void handle_setup(struct at91_udc *udc, struct at91_ep *ep, u32 csr) | |||
1153 | | USB_REQ_GET_STATUS: | 1153 | | USB_REQ_GET_STATUS: |
1154 | tmp = w_index & USB_ENDPOINT_NUMBER_MASK; | 1154 | tmp = w_index & USB_ENDPOINT_NUMBER_MASK; |
1155 | ep = &udc->ep[tmp]; | 1155 | ep = &udc->ep[tmp]; |
1156 | if (tmp > NUM_ENDPOINTS || (tmp && !ep->desc)) | 1156 | if (tmp >= NUM_ENDPOINTS || (tmp && !ep->desc)) |
1157 | goto stall; | 1157 | goto stall; |
1158 | 1158 | ||
1159 | if (tmp) { | 1159 | if (tmp) { |
@@ -1176,7 +1176,7 @@ static void handle_setup(struct at91_udc *udc, struct at91_ep *ep, u32 csr) | |||
1176 | | USB_REQ_SET_FEATURE: | 1176 | | USB_REQ_SET_FEATURE: |
1177 | tmp = w_index & USB_ENDPOINT_NUMBER_MASK; | 1177 | tmp = w_index & USB_ENDPOINT_NUMBER_MASK; |
1178 | ep = &udc->ep[tmp]; | 1178 | ep = &udc->ep[tmp]; |
1179 | if (w_value != USB_ENDPOINT_HALT || tmp > NUM_ENDPOINTS) | 1179 | if (w_value != USB_ENDPOINT_HALT || tmp >= NUM_ENDPOINTS) |
1180 | goto stall; | 1180 | goto stall; |
1181 | if (!ep->desc || ep->is_iso) | 1181 | if (!ep->desc || ep->is_iso) |
1182 | goto stall; | 1182 | goto stall; |
@@ -1195,7 +1195,7 @@ static void handle_setup(struct at91_udc *udc, struct at91_ep *ep, u32 csr) | |||
1195 | | USB_REQ_CLEAR_FEATURE: | 1195 | | USB_REQ_CLEAR_FEATURE: |
1196 | tmp = w_index & USB_ENDPOINT_NUMBER_MASK; | 1196 | tmp = w_index & USB_ENDPOINT_NUMBER_MASK; |
1197 | ep = &udc->ep[tmp]; | 1197 | ep = &udc->ep[tmp]; |
1198 | if (w_value != USB_ENDPOINT_HALT || tmp > NUM_ENDPOINTS) | 1198 | if (w_value != USB_ENDPOINT_HALT || tmp >= NUM_ENDPOINTS) |
1199 | goto stall; | 1199 | goto stall; |
1200 | if (tmp == 0) | 1200 | if (tmp == 0) |
1201 | goto succeed; | 1201 | goto succeed; |