Fix edge cases in several KASSERTs: use <= rather than < when testing that
counters have not gone about MAXCPU or NETISR_MAXPROT. These problems caused panics on UP kernels with INVARIANTS when using sysctl -a, but would also have caused problems for 32-core boxes or if the netisr protocol vector was fully populated. Reported by: nwhitehorn, Neel Natu <neelnatu@gmail.com> MFC after: 4 days
This commit is contained in:
parent
605cf4275d
commit
7f450feb07
@ -1167,7 +1167,7 @@ sysctl_netisr_proto(SYSCTL_HANDLER_ARGS)
|
||||
counter++;
|
||||
}
|
||||
NETISR_RUNLOCK(&tracker);
|
||||
KASSERT(counter < NETISR_MAXPROT,
|
||||
KASSERT(counter <= NETISR_MAXPROT,
|
||||
("sysctl_netisr_proto: counter too big (%d)", counter));
|
||||
error = SYSCTL_OUT(req, snp_array, sizeof(*snp_array) * counter);
|
||||
free(snp_array, M_TEMP);
|
||||
@ -1220,7 +1220,7 @@ sysctl_netisr_workstream(SYSCTL_HANDLER_ARGS)
|
||||
counter++;
|
||||
}
|
||||
NETISR_RUNLOCK(&tracker);
|
||||
KASSERT(counter < MAXCPU,
|
||||
KASSERT(counter <= MAXCPU,
|
||||
("sysctl_netisr_workstream: counter too big (%d)", counter));
|
||||
error = SYSCTL_OUT(req, snws_array, sizeof(*snws_array) * counter);
|
||||
free(snws_array, M_TEMP);
|
||||
@ -1281,7 +1281,7 @@ sysctl_netisr_work(SYSCTL_HANDLER_ARGS)
|
||||
}
|
||||
NWS_UNLOCK(nwsp);
|
||||
}
|
||||
KASSERT(counter < MAXCPU * NETISR_MAXPROT,
|
||||
KASSERT(counter <= MAXCPU * NETISR_MAXPROT,
|
||||
("sysctl_netisr_work: counter too big (%d)", counter));
|
||||
NETISR_RUNLOCK(&tracker);
|
||||
error = SYSCTL_OUT(req, snw_array, sizeof(*snw_array) * counter);
|
||||
|
Loading…
x
Reference in New Issue
Block a user