USB: wusb: check CHID is all zeros before stopping the host
authorJulia Lawall <julia@diku.dk>
Thu, 17 Dec 2009 13:57:33 +0000 (13:57 +0000)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 2 Mar 2010 22:53:20 +0000 (14:53 -0800)
An incorrect sizeof() resulted in only 4 (or 8) octets of the CHID being
checked instead of all 16 octets.  A randomly generated CHID had a
probability of being unable to start a WUSB host of less than 1 in
2 billion.

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: David Vrabel <david.vrabel@csr.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/wusbcore/mmc.c

index 3b52161e6e9cd8d5af017879f78613eb11f7b729..2d827397e30b2dbddd121342a8899d9e028b0867 100644 (file)
@@ -263,7 +263,7 @@ int wusbhc_chid_set(struct wusbhc *wusbhc, const struct wusb_ckhdid *chid)
 {
        int result = 0;
 
-       if (memcmp(chid, &wusb_ckhdid_zero, sizeof(chid)) == 0)
+       if (memcmp(chid, &wusb_ckhdid_zero, sizeof(*chid)) == 0)
                chid = NULL;
 
        mutex_lock(&wusbhc->mutex);