firewire: net: fix NULL derefencing in fwnet_probe()
authorDaeseok Youn <daeseok.youn@gmail.com>
Tue, 29 Apr 2014 09:49:47 +0000 (18:49 +0900)
committerStefan Richter <stefanr@s5r6.in-berlin.de>
Mon, 12 May 2014 12:35:31 +0000 (14:35 +0200)
"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>
drivers/firewire/net.c

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