Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 15 Jan 2020 15:31:35 +0000 (UTC)
From:      Mark Johnston <markj@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r356760 - head/sys/compat/linuxkpi/common/src
Message-ID:  <202001151531.00FFVZUA048344@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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-rpi03@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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202001151531.00FFVZUA048344>