summaryrefslogtreecommitdiffstats
path: root/drivers/usb/wusbcore
diff options
context:
space:
mode:
authorAkinobu Mita <akinobu.mita@gmail.com>2011-03-02 12:35:28 +0100
committerGreg Kroah-Hartman <gregkh@suse.de>2011-03-03 01:52:28 +0100
commit962f3ffa927f2e777a4193843c45ffa6e52ff4b6 (patch)
treec28bc6eb94b6e4d4de5a4e918b7cf170f4e2485f /drivers/usb/wusbcore
parentusb: EHCI, OHCI: Add configuration for the SH USB controller (diff)
downloadlinux-962f3ffa927f2e777a4193843c45ffa6e52ff4b6.tar.xz
linux-962f3ffa927f2e777a4193843c45ffa6e52ff4b6.zip
wusb: fix find_first_zero_bit() return value check
In wusb_cluster_id_get(), if no zero bits exist in wusb_cluster_id_table, find_first_zero_bit() returns CLUSTER_IDS. But it is impossible to detect that the bitmap is full because there is an off-by-one error in the return value check. It will cause unexpected memory access by setting bit out of wusb_cluster_id_table bitmap, and caller will get wrong cluster id. Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com> Cc: linux-usb@vger.kernel.org Cc: Greg Kroah-Hartman <gregkh@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/wusbcore')
-rw-r--r--drivers/usb/wusbcore/wusbhc.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/usb/wusbcore/wusbhc.c b/drivers/usb/wusbcore/wusbhc.c
index 2054d4ee9774..0faca16df765 100644
--- a/drivers/usb/wusbcore/wusbhc.c
+++ b/drivers/usb/wusbcore/wusbhc.c
@@ -320,7 +320,7 @@ u8 wusb_cluster_id_get(void)
u8 id;
spin_lock(&wusb_cluster_ids_lock);
id = find_first_zero_bit(wusb_cluster_id_table, CLUSTER_IDS);
- if (id > CLUSTER_IDS) {
+ if (id >= CLUSTER_IDS) {
id = 0;
goto out;
}