瀏覽代碼

usb: core: check for valid id_table when using the RefId feature

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 <wsa@the-dreams.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Wolfram Sang 12 年之前
父節點
當前提交
1b9fb31f7d
共有 1 個文件被更改,包括 3 次插入0 次删除
  1. 3 0
      drivers/usb/core/driver.c

+ 3 - 0
drivers/usb/core/driver.c

@@ -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;