Browse Source

firewire: net: fix NULL derefencing in fwnet_probe()

"dev" and "net" are NULL when alloc_netdev() is failed.
So just unlock and return an error.

Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Daeseok Youn 11 years ago
parent
commit
1118f8d048
1 changed files with 2 additions and 2 deletions
  1. 2 2
      drivers/firewire/net.c

+ 2 - 2
drivers/firewire/net.c

@@ -1462,8 +1462,8 @@ static int fwnet_probe(struct fw_unit *unit,
 
 
 	net = alloc_netdev(sizeof(*dev), "firewire%d", fwnet_init_dev);
 	net = alloc_netdev(sizeof(*dev), "firewire%d", fwnet_init_dev);
 	if (net == NULL) {
 	if (net == NULL) {
-		ret = -ENOMEM;
-		goto out;
+		mutex_unlock(&fwnet_device_mutex);
+		return -ENOMEM;
 	}
 	}
 
 
 	allocated_netdev = true;
 	allocated_netdev = true;