Browse Source

Staging: wlags49_h2: potential NULL dereference

wl_device_dealloc() dereferences the "dev" paramter, so let's move it
under the check for NULL.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Dan Carpenter 13 năm trước cách đây
mục cha
commit
bed861ba2a
1 tập tin đã thay đổi với 1 bổ sung2 xóa
  1. 1 2
      drivers/staging/wlags49_h2/wl_cs.c

+ 1 - 2
drivers/staging/wlags49_h2/wl_cs.c

@@ -177,10 +177,9 @@ static void wl_adapter_detach(struct pcmcia_device *link)
 	if (dev) {
 		unregister_wlags_sysfs(dev);
 		unregister_netdev(dev);
+		wl_device_dealloc(dev);
 	}
 
-	wl_device_dealloc(dev);
-
 	DBG_LEAVE(DbgInfo);
 } /* wl_adapter_detach */
 /*============================================================================*/