diff options
author | Rebecca Cran <brucec@FreeBSD.org> | 2012-03-04 17:08:43 +0000 |
---|---|---|
committer | Rebecca Cran <brucec@FreeBSD.org> | 2012-03-04 17:08:43 +0000 |
commit | 03225fac13a1dd7410c74fcf8e130e6010f32ecc (patch) | |
tree | 2a9289b7bdaf4de7a552bfe4aae41276d0f3ade7 /sys/compat | |
parent | 4a63252f49321c61e46bacb990db7c5f69939d6e (diff) | |
download | src-03225fac13a1dd7410c74fcf8e130e6010f32ecc.tar.gz src-03225fac13a1dd7410c74fcf8e130e6010f32ecc.zip |
Fix race condition in KfRaiseIrql().
After getting the current irql, if the kthread gets preempted and
subsequently runs on a different CPU, the saved irql could be wrong.
Also, correct the panic string.
PR: kern/165630
Submitted by: Vladislav Movchan <vladislav.movchan at gmail.com>
Notes
Notes:
svn path=/head/; revision=232509
Diffstat (limited to 'sys/compat')
-rw-r--r-- | sys/compat/ndis/subr_hal.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/sys/compat/ndis/subr_hal.c b/sys/compat/ndis/subr_hal.c index 45f34408c461..62d97adf22b3 100644 --- a/sys/compat/ndis/subr_hal.c +++ b/sys/compat/ndis/subr_hal.c @@ -392,16 +392,18 @@ KfRaiseIrql(uint8_t irql) { uint8_t oldirql; + sched_pin(); oldirql = KeGetCurrentIrql(); /* I am so going to hell for this. */ if (oldirql > irql) - panic("IRQL_NOT_LESS_THAN"); + panic("IRQL_NOT_LESS_THAN_OR_EQUAL"); - if (oldirql != DISPATCH_LEVEL) { - sched_pin(); + if (oldirql != DISPATCH_LEVEL) mtx_lock(&disp_lock[curthread->td_oncpu]); - } + else + sched_unpin(); + /*printf("RAISE IRQL: %d %d\n", irql, oldirql);*/ return (oldirql); |