summaryrefslogtreecommitdiffstats
path: root/sys/ofed/include/linux/file.h
diff options
context:
space:
mode:
Diffstat (limited to 'sys/ofed/include/linux/file.h')
-rw-r--r--sys/ofed/include/linux/file.h15
1 files changed, 14 insertions, 1 deletions
diff --git a/sys/ofed/include/linux/file.h b/sys/ofed/include/linux/file.h
index 6576cd0..b76a408 100644
--- a/sys/ofed/include/linux/file.h
+++ b/sys/ofed/include/linux/file.h
@@ -77,7 +77,15 @@ put_unused_fd(unsigned int fd)
NULL) != 0) {
return;
}
+ /*
+ * NOTE: We should only get here when the "fd" has not been
+ * installed, so no need to free the associated Linux file
+ * structure.
+ */
fdclose(curthread->td_proc->p_fd, file, fd, curthread);
+
+ /* drop extra reference */
+ fdrop(file, curthread);
}
static inline void
@@ -90,7 +98,10 @@ fd_install(unsigned int fd, struct linux_file *filp)
file = NULL;
}
filp->_file = file;
- finit(file, filp->f_mode, DTYPE_DEV, filp, &linuxfileops);
+ finit(file, filp->f_mode, DTYPE_DEV, filp, &linuxfileops);
+
+ /* drop the extra reference */
+ fput(filp);
}
static inline int
@@ -103,6 +114,8 @@ get_unused_fd(void)
error = falloc(curthread, &file, &fd, 0);
if (error)
return -error;
+ /* drop the extra reference */
+ fdrop(file, curthread);
return fd;
}
OpenPOWER on IntegriCloud