Skip to content

Commit

Permalink
usb: core: check for valid id_table when using the RefId feature
Browse files Browse the repository at this point in the history
When implementing the RefId feature, it was missed that id_tables can be
NULL under special circumstances. Bail out in that case.

Signed-off-by: Wolfram Sang <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
Wolfram Sang authored and gregkh committed Jan 13, 2014
1 parent f563926 commit 1b9fb31
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/usb/core/driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ ssize_t usb_store_new_id(struct usb_dynids *dynids,
if (fields > 4) {
const struct usb_device_id *id = id_table;

if (!id)
return -ENODEV;

for (; id->match_flags; id++)
if (id->idVendor == refVendor && id->idProduct == refProduct)
break;
Expand Down

0 comments on commit 1b9fb31

Please sign in to comment.