Skip to contentSkip to conversation

staging: wilc1000: NULL dereference on error

PATCH In review Dan Carpenter 2 participants 3 messages Jul 16, 2016

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: wilc1000: NULL dereference on error

We can't pass NULL pointers to destroy_workqueue().

drivers/staging/wilc1000/host_interface.c +1 -2
index 0b1760c..78f524f 100644
@@ -3363,7 +3363,7 @@ int wilc_init(struct net_device *dev, struct host_if_drv **hif_drv_handler)
 		if (!hif_workqueue) {
 			netdev_err(vif->ndev, "Failed to create workqueue\n");
 			result = -ENOMEM;
-			goto _fail_mq_;
+			goto _fail_;
 		}
 
 		setup_timer(&periodic_rssi, GetPeriodicRSSI,
@@ -3391,7 +3391,6 @@ int wilc_init(struct net_device *dev, struct host_if_drv **hif_drv_handler)
 
 	clients_count++;
 
-_fail_mq_:
 	destroy_workqueue(hif_workqueue);
 _fail_:
 	return result;
#1 lore raw

Am 16.07.2016 12:07, schrieb Dan Carpenter:

Quoted 9 lines

We can't pass NULL pointers to destroy_workqueue().

drivers/staging/wilc1000/host_interface.c +0 -0
index 0b1760c..78f524f 100644

drivers/staging/wilc1000/host_interface.c int wilc_init(struct net_device *dev, struct host_if_drv **hif_drv_handler) · line 3368

Quoted 7 lines
drivers/staging/wilc1000/host_interface.c +1 -1
@@ -3363,7 +3363,7 @@ int wilc_init(struct net_device *dev, struct host_if_drv **hif_drv_handler)
 		if (!hif_workqueue) {
 			netdev_err(vif->ndev, "Failed to create workqueue\n");
 			result = -ENOMEM;
-			goto _fail_mq_;
+			goto _fail_;
 		}
 

maybe this is the point where return -ENOMEM; is the most simple solution ?

re,
wh

Quoted 14 lines
drivers/staging/wilc1000/host_interface.c +0 -2
 		setup_timer(&periodic_rssi, GetPeriodicRSSI,
@@ -3391,7 +3391,6 @@ int wilc_init(struct net_device *dev, struct host_if_drv **hif_drv_handler)
 
 	clients_count++;
 
-_fail_mq_:
 	destroy_workqueue(hif_workqueue);
 _fail_:
 	return result;
--

To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#2 lore raw
In reply to Dan Carpenter
Quoted 7 lines · walter harms

Am 16.07.2016 12:07, schrieb Dan Carpenter:

Quoted 4 lines

We can't pass NULL pointers to destroy_workqueue().

Quoted 15 lines

drivers/staging/wilc1000/host_interface.c int wilc_init(struct net_device *dev, struct host_if_drv **hif_drv_handler) · line 3368

Quoted 12 lines
drivers/staging/wilc1000/host_interface.c +1 -1
index 0b1760c..78f524f 100644
@@ -3363,7 +3363,7 @@ int wilc_init(struct net_device *dev, struct host_if_drv **hif_drv_handler)
 		if (!hif_workqueue) {
 			netdev_err(vif->ndev, "Failed to create workqueue\n");
 			result = -ENOMEM;
-			goto _fail_mq_;
+			goto _fail_;
 		}
 

maybe this is the point where return -ENOMEM; is the most simple solution ?

Yeah. This code is staging quality. There are lots of other cleanups someone could do. Later patches...

regards,
dan carpenter