Skip to contentSkip to conversation

firewire: fix NULL derefencing in fwnet_probe()

PATCH Applied Daeseok Youn 2 participants 2 messages Apr 29, 2014 – May 12, 2014 Firewire

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 firewire: fix NULL derefencing in fwnet_probe()

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

---
 drivers/firewire/net.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/firewire/net.c +2 -2
index 4af0a7b..c398645 100644
@@ -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;
Signature · 1 line
1.7.4.4
#1 lore raw
Quoted 4 lines · On Apr 29 Daeseok Youn wrote:

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

Pushed to linux1394.git. Thank you.

Quoted 19 lines
---
 drivers/firewire/net.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/firewire/net.c +2 -2
index 4af0a7b..c398645 100644
@@ -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;
Signature · 3 lines
Stefan Richter
-=====-====- -=-= -==--
http://arcgraph.de/sr/