patch-2.3.99-pre7 linux/drivers/char/tty_io.c

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

diff -u --recursive --new-file v2.3.99-pre6/linux/drivers/char/tty_io.c linux/drivers/char/tty_io.c
@@ -1384,7 +1384,9 @@
 	    current->leader &&
 	    !current->tty &&
 	    tty->session == 0) {
+	    	task_lock(current);
 		current->tty = tty;
+		task_unlock(current);
 		current->tty_old_pgrp = 0;
 		tty->session = current->session;
 		tty->pgrp = current->pgrp;
@@ -1594,7 +1596,9 @@
 		} else
 			return -EPERM;
 	}
+	task_lock(current);
 	current->tty = tty;
+	task_unlock(current);
 	current->tty_old_pgrp = 0;
 	tty->session = current->session;
 	tty->pgrp = current->pgrp;
@@ -1761,7 +1765,9 @@
 				return -ENOTTY;
 			if (current->leader)
 				disassociate_ctty(0);
+			task_lock(current);
 			current->tty = NULL;
+			task_unlock(current);
 			return 0;
 		case TIOCSCTTY:
 			return tiocsctty(tty, arg);
@@ -1858,8 +1864,9 @@
 			send_sig(SIGKILL, p, 1);
 		else if (p->files) {
 			read_lock(&p->files->file_lock);
+			/* FIXME: p->files could change */
 			for (i=0; i < p->files->max_fds; i++) {
-				filp = fcheck_task(p, i);
+				filp = fcheck_files(p->files, i);
 				if (filp && (filp->f_op == &tty_fops) &&
 				    (filp->private_data == tty)) {
 					send_sig(SIGKILL, p, 1);

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