svn commit: r272726 - stable/10/sys/kern

Neel Natu neel at FreeBSD.org
Wed Oct 8 04:35:10 UTC 2014


Author: neel
Date: Wed Oct  8 04:35:09 2014
New Revision: 272726
URL: https://svnweb.freebsd.org/changeset/base/272726

Log:
  MFC r272270:
  
  tty_rel_free() can be called more than once for the same tty so make sure
  that the tty is dequeued from 'tty_list' only the first time.

Modified:
  stable/10/sys/kern/tty.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/kern/tty.c
==============================================================================
--- stable/10/sys/kern/tty.c	Wed Oct  8 04:34:46 2014	(r272725)
+++ stable/10/sys/kern/tty.c	Wed Oct  8 04:35:09 2014	(r272726)
@@ -1055,13 +1055,13 @@ tty_rel_free(struct tty *tp)
 	tp->t_dev = NULL;
 	tty_unlock(tp);
 
-	sx_xlock(&tty_list_sx);
-	TAILQ_REMOVE(&tty_list, tp, t_list);
-	tty_list_count--;
-	sx_xunlock(&tty_list_sx);
-
-	if (dev != NULL)
+	if (dev != NULL) {
+		sx_xlock(&tty_list_sx);
+		TAILQ_REMOVE(&tty_list, tp, t_list);
+		tty_list_count--;
+		sx_xunlock(&tty_list_sx);
 		destroy_dev_sched_cb(dev, tty_dealloc, tp);
+	}
 }
 
 void


More information about the svn-src-stable-10 mailing list