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 4af0a7bad7f21561cc4e7a29031c238a34f0135d..c3986452194dd01ee4fed4b4bff14f9f5813523d 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;