Page MenuHomeFreeBSD

D4351.id10679.diff
No OneTemporary

D4351.id10679.diff

Index: sys/compat/linuxkpi/common/include/linux/file.h
===================================================================
--- sys/compat/linuxkpi/common/include/linux/file.h
+++ sys/compat/linuxkpi/common/include/linux/file.h
@@ -89,7 +89,10 @@
*/
fdclose(curthread, file, fd);
- /* drop extra reference */
+ /* drop reference from fget_unlocked() */
+ fdrop(file, curthread);
+
+ /* drop extra reference from falloc() */
fdrop(file, curthread);
}
@@ -101,12 +104,17 @@
if (fget_unlocked(curthread->td_proc->p_fd, fd,
cap_rights_init(&rights), &file, NULL) != 0) {
- file = NULL;
- }
- filp->_file = file;
- finit(file, filp->f_mode, DTYPE_DEV, filp, &linuxfileops);
+ filp->_file = NULL;
+ } else {
+ filp->_file = file;
+
+ /* init file */
+ finit(file, filp->f_mode, DTYPE_DEV, filp, &linuxfileops);
- /* drop the extra reference */
+ /* drop the reference from fget_unlocked() */
+ fput(filp);
+ }
+ /* drop extra reference from falloc() */
fput(filp);
}
@@ -120,8 +128,6 @@
error = falloc(curthread, &file, &fd, 0);
if (error)
return -error;
- /* drop the extra reference */
- fdrop(file, curthread);
return fd;
}
@@ -135,8 +141,6 @@
error = falloc(curthread, &file, &fd, flags);
if (error)
return -error;
- /* drop the extra reference */
- fdrop(file, curthread);
return fd;
}

File Metadata

Mime Type
text/plain
Expires
Sat, Aug 29, 4:27 AM (18 h, 26 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
37496090
Default Alt Text
D4351.id10679.diff (1 KB)

Event Timeline