summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sys/fs/devfs/devfs_vnops.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/sys/fs/devfs/devfs_vnops.c b/sys/fs/devfs/devfs_vnops.c
index 22908b9..408c981 100644
--- a/sys/fs/devfs/devfs_vnops.c
+++ b/sys/fs/devfs/devfs_vnops.c
@@ -602,10 +602,14 @@ devfs_close_f(struct file *fp, struct thread *td)
int error;
struct file *fpop;
- fpop = td->td_fpop;
- td->td_fpop = fp;
+ /*
+ * NB: td may be NULL if this descriptor is closed due to
+ * garbage collection from a closed UNIX domain socket.
+ */
+ fpop = curthread->td_fpop;
+ curthread->td_fpop = fp;
error = vnops.fo_close(fp, td);
- td->td_fpop = fpop;
+ curthread->td_fpop = fpop;
/*
* The f_cdevpriv cannot be assigned non-NULL value while we
OpenPOWER on IntegriCloud