Skip to content

Commit

Permalink
USB: wusb: check CHID is all zeros before stopping the host
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Julia Lawall authored and Greg Kroah-Hartman committed Mar 2, 2010
1 parent 319c3ea commit 8bc1d21
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/usb/wusbcore/mmc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 8bc1d21

Please sign in to comment.