Author: neel
Date: Wed Oct  8 15:39:24 2014
New Revision: 272752
URL: https://svnweb.freebsd.org/changeset/base/272752

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.
  
  Approved by:  re (glebius)

Modified:
  releng/10.1/sys/kern/tty.c
Directory Properties:
  releng/10.1/   (props changed)

Modified: releng/10.1/sys/kern/tty.c
==============================================================================
--- releng/10.1/sys/kern/tty.c  Wed Oct  8 15:30:59 2014        (r272751)
+++ releng/10.1/sys/kern/tty.c  Wed Oct  8 15:39:24 2014        (r272752)
@@ -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
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to