When devfs dirent is freed, a vnode might still keep a pointer to it,
apparently. Interlock and clear the pointer to avoid free memory dereference. Submitted by: bde (previous version) MFC after: 3 weeks
This commit is contained in:
parent
7b7fe5c956
commit
8c18805577
@ -304,6 +304,13 @@ devfs_vmkdir(struct devfs_mount *dmp, char *name, int namelen, struct devfs_dire
|
||||
void
|
||||
devfs_dirent_free(struct devfs_dirent *de)
|
||||
{
|
||||
struct vnode *vp;
|
||||
|
||||
vp = de->de_vnode;
|
||||
mtx_lock(&devfs_de_interlock);
|
||||
if (vp != NULL && vp->v_data == de)
|
||||
vp->v_data = NULL;
|
||||
mtx_unlock(&devfs_de_interlock);
|
||||
free(de, M_DEVFS3);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user