⬢ DragonFlyBSD Kernel Audit
DF-2945 / fix.diff
← back to finding ↓ download raw
--- a/sys/kern/kern_acct.c
+++ b/sys/kern/kern_acct.c
@@ -332,12 +332,13 @@
 	struct statfs sb;
 
 	if (savacctp != NULLVP) {
-		if (savacctp->v_type == VBAD) {
+		if (savacctp->v_type == VBAD || savacctp->v_mount == NULL) {
 			(void) vn_close(savacctp, FWRITE | O_APPEND, NULL);
 			savacctp = NULLVP;
 			return;
 		}
-		(void)VFS_STATFS(savacctp->v_mount, &sb, proc0.p_ucred);
+		if (VFS_STATFS(savacctp->v_mount, &sb, proc0.p_ucred) != 0)
+			return;
 		if (sb.f_bavail > acctresume * sb.f_blocks / 100) {
 			acctp = savacctp;
 			savacctp = NULLVP;
@@ -346,12 +347,13 @@
 	} else {
 		if (acctp == NULLVP)
 			return;
-		if (acctp->v_type == VBAD) {
+		if (acctp->v_type == VBAD || acctp->v_mount == NULL) {
 			(void) vn_close(acctp, FWRITE | O_APPEND, NULL);
 			acctp = NULLVP;
 			return;
 		}
-		(void)VFS_STATFS(acctp->v_mount, &sb, proc0.p_ucred);
+		if (VFS_STATFS(acctp->v_mount, &sb, proc0.p_ucred) != 0)
+			return;
 		if (sb.f_bavail <= acctsuspend * sb.f_blocks / 100) {
 			savacctp = acctp;
 			acctp = NULLVP;