patch-2.4.0-test12 linux/drivers/char/istallion.c

Next file: linux/drivers/char/mixcomwd.c
Previous file: linux/drivers/char/isicom.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.0-test11/linux/drivers/char/istallion.c linux/drivers/char/istallion.c
@@ -2363,12 +2363,18 @@
 	printk("stli_dohangup(portp=%x)\n", (int) arg);
 #endif
 
+	/*
+	 * FIXME: There's a module removal race here: tty_hangup
+	 * calls schedule_task which will call into this
+	 * driver later.
+	 */
 	portp = (stliport_t *) arg;
-	if (portp == (stliport_t *) NULL)
-		return;
-	if (portp->tty == (struct tty_struct *) NULL)
-		return;
-	tty_hangup(portp->tty);
+	if (portp != (stliport_t *) NULL) {
+		if (portp->tty != (struct tty_struct *) NULL) {
+			tty_hangup(portp->tty);
+		}
+	}
+	MOD_DEC_USE_COUNT;
 }
 
 /*****************************************************************************/
@@ -2999,8 +3005,11 @@
 				if (portp->flags & ASYNC_CHECK_CD) {
 					if (! ((portp->flags & ASYNC_CALLOUT_ACTIVE) &&
 					    (portp->flags & ASYNC_CALLOUT_NOHUP))) {
-						if (tty != (struct tty_struct *) NULL)
-							queue_task(&portp->tqhangup, &tq_scheduler);
+						if (tty != (struct tty_struct *) NULL) {
+							MOD_INC_USE_COUNT;
+							if (schedule_task(&portp->tqhangup) == 0)
+								MOD_DEC_USE_COUNT;
+						}
 					}
 				}
 			}

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)