Fix a memory leak in __getcwd() that can occur after a filesystem
has been forcibly unmounted. If the filesystem root vnode is reached and it has no associated mountpoint (vp->v_mount == NULL), __getcwd would return without freeing 'buf'. Add the missing free() call. PR: kern/30306 Submitted by: Mike Potanin <potanin@mccme.ru> MFC after: 1 week
This commit is contained in:
parent
1106c5f173
commit
7476f7e87d
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=83000
@ -687,8 +687,10 @@ __getcwd(p, uap)
|
||||
slash_prefixed = 0;
|
||||
for (vp = fdp->fd_cdir; vp != fdp->fd_rdir && vp != rootvnode;) {
|
||||
if (vp->v_flag & VROOT) {
|
||||
if (vp->v_mount == NULL) /* forced unmount */
|
||||
if (vp->v_mount == NULL) { /* forced unmount */
|
||||
free(buf, M_TEMP);
|
||||
return (EBADF);
|
||||
}
|
||||
vp = vp->v_mount->mnt_vnodecovered;
|
||||
continue;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user