浏览代码

[PATCH] USB: check for device in zd1201_resume

My patch adding PM support for zd1201 didn't check for the device on
resume, which can oops if the device has been removed.

This patch fixes it.

Signed-off-by: Colin Leroy <colin@colino.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Colin Leroy 20 年之前
父节点
当前提交
f58f97fa9d
共有 1 个文件被更改,包括 3 次插入0 次删除
  1. 3 0
      drivers/usb/net/zd1201.c

+ 3 - 0
drivers/usb/net/zd1201.c

@@ -1905,6 +1905,9 @@ static int zd1201_resume(struct usb_interface *interface)
 {
 	struct zd1201 *zd = usb_get_intfdata(interface);
 
+	if (!zd || !zd->dev)
+		return -ENODEV;
+
 	netif_device_attach(zd->dev);
 
 	if (zd->was_enabled)