Author: markj
Date: Wed Jan 15 15:31:35 2020
New Revision: 356760
URL: https://svnweb.freebsd.org/changeset/base/356760

Log:
  Handle a NULL thread pointer in linux_close_file().
  
  This can happen if a file is closed during unix socket GC.  The same bug
  was fixed for devfs descriptors in r228361.
  
  PR:           242913
  Reported and tested by:       iz-rp...@hs-karlsruhe.de
  Reviewed by:  hselasky, kib
  MFC after:    1 week
  Sponsored by: The FreeBSD Foundation
  Differential Revision:        https://reviews.freebsd.org/D23178

Modified:
  head/sys/compat/linuxkpi/common/src/linux_compat.c

Modified: head/sys/compat/linuxkpi/common/src/linux_compat.c
==============================================================================
--- head/sys/compat/linuxkpi/common/src/linux_compat.c  Wed Jan 15 13:52:13 
2020        (r356759)
+++ head/sys/compat/linuxkpi/common/src/linux_compat.c  Wed Jan 15 15:31:35 
2020        (r356760)
@@ -1498,6 +1498,9 @@ linux_file_close(struct file *file, struct thread *td)
        KASSERT(file_count(filp) == 0,
            ("File refcount(%d) is not zero", file_count(filp)));
 
+       if (td == NULL)
+               td = curthread;
+
        error = 0;
        filp->f_flags = file->f_flag;
        linux_set_current(td);
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to