Free mount credentials (mnt_cred) when freeing the mount struct
in failure cases to avoid leaking struct ucreds, and ultimately leaking struct uidinfo references.
This commit is contained in:
parent
2ea336196e
commit
d7f1e14b89
@ -701,6 +701,7 @@ vfs_nmount(td, fsflags, fsoptions)
|
||||
#ifdef MAC
|
||||
mac_destroy_mount(mp);
|
||||
#endif
|
||||
crfree(mp->mnt_cred);
|
||||
free(mp, M_MOUNT);
|
||||
}
|
||||
vrele(vp);
|
||||
@ -794,6 +795,7 @@ vfs_nmount(td, fsflags, fsoptions)
|
||||
#ifdef MAC
|
||||
mac_destroy_mount(mp);
|
||||
#endif
|
||||
crfree(mp->mnt_cred);
|
||||
free(mp, M_MOUNT);
|
||||
vput(vp);
|
||||
goto bad;
|
||||
@ -1064,6 +1066,7 @@ vfs_mount(td, fstype, fspath, fsflags, fsdata)
|
||||
#ifdef MAC
|
||||
mac_destroy_mount(mp);
|
||||
#endif
|
||||
crfree(mp->mnt_cred);
|
||||
free(mp, M_MOUNT);
|
||||
}
|
||||
vrele(vp);
|
||||
@ -1144,6 +1147,7 @@ vfs_mount(td, fstype, fspath, fsflags, fsdata)
|
||||
#ifdef MAC
|
||||
mac_destroy_mount(mp);
|
||||
#endif
|
||||
crfree(mp->mnt_cred);
|
||||
free(mp, M_MOUNT);
|
||||
vput(vp);
|
||||
}
|
||||
@ -1570,6 +1574,7 @@ vfs_mountroot_try(char *mountfrom)
|
||||
#ifdef MAC
|
||||
mac_destroy_mount(mp);
|
||||
#endif
|
||||
crfree(mp->mnt_cred);
|
||||
free(mp, M_MOUNT);
|
||||
}
|
||||
printf("Root mount failed: %d\n", error);
|
||||
|
Loading…
Reference in New Issue
Block a user