Merge kern_descrip.c:1.284 from HEAD to RELENG_6:
In closef(), remove the assumption that there is a thread associated with the file descriptor. When a file descriptor is closed as a result of garbage collecting a UNIX domain socket, the file descriptor will not have any associated thread, so the logic to identify advisory locks held by that thread is not appropriate. Check the thread for NULL to avoid this scenario. Expand an existing comment to say a bit more about this.
This commit is contained in:
parent
2b05328a55
commit
6b9e4e50dc
@ -1880,9 +1880,13 @@ closef(struct file *fp, struct thread *td)
|
||||
* a flag in the unlock to free ONLY locks obeying POSIX
|
||||
* semantics, and not to free BSD-style file locks.
|
||||
* If the descriptor was in a message, POSIX-style locks
|
||||
* aren't passed with the descriptor.
|
||||
* aren't passed with the descriptor, and the thread pointer
|
||||
* will be NULL. Callers should be careful only to pass a
|
||||
* NULL thread pointer when there really is no owning
|
||||
* context that might have locks, or the locks will be
|
||||
* leaked.
|
||||
*/
|
||||
if (fp->f_type == DTYPE_VNODE) {
|
||||
if (fp->f_type == DTYPE_VNODE && td != NULL) {
|
||||
int vfslocked;
|
||||
|
||||
vp = fp->f_vnode;
|
||||
|
Loading…
x
Reference in New Issue
Block a user