Skip to contentSkip to conversation

e100 schedule while atomic

PATCH New Arnd Bergmann 1 participant 1 message Sep 28, 2002 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 e100 schedule while atomic

Running e100 on linux-2.5.39 showed that the driver incorrectly holds a lock while calling request_irq(), which does kmalloc().

This patch appears to solve the problem. Not sure if it is correct, but something like it has to be done.

	Arnd <><

===== drivers/net/e100/e100_main.c 1.25 vs edited =====

drivers/net/e100/e100_main.c +15 -4
@@ -986,11 +986,20 @@
 	netif_start_queue(dev);
 
 	e100_start_ru(bdp);
-	if ((rc = request_irq(dev->irq, &e100intr, SA_SHIRQ,
-			      dev->name, dev)) != 0) {
-		del_timer_sync(&bdp->watchdog_timer);
-		goto err_exit;
+
+	read_unlock(&(bdp->isolate_lock));
+	rc = request_irq(dev->irq, &e100intr, SA_SHIRQ, dev->name, dev);
+	read_lock(&(bdp->isolate_lock));
+
+	if (rc != 0)
+		goto err_exit2;
+
+	if (bdp->driver_isolated) {
+		free_irq(dev->irq, dev);
+		rc = -EBUSY;
+		goto err_exit2;
 	}
+
 	if (bdp->params.b_params & PRM_RX_CONG) {
 		DECLARE_TASKLET(polling_tasklet,
 				e100_polling_tasklet, (unsigned long) bdp);
@@ -1003,6 +1012,8 @@
 
 	goto exit;
 
+err_exit2:
+	del_timer_sync(&bdp->watchdog_timer);
 err_exit:
 	e100_clear_pools(bdp);
 exit: