aboutsummaryrefslogtreecommitdiff
path: root/sys/sys/lock.h
diff options
context:
space:
mode:
authorMateusz Guzik <mjg@FreeBSD.org>2020-07-23 17:26:53 +0000
committerMateusz Guzik <mjg@FreeBSD.org>2020-07-23 17:26:53 +0000
commitc795344ff71ff37ee942ac1ace3705a58a9d9ad8 (patch)
tree9e68af145b3af63758a4d41639dc738e81da2690 /sys/sys/lock.h
parente605dcc939848312a201b4aa53bd7bb67d862b18 (diff)
downloadsrc-c795344ff71ff37ee942ac1ace3705a58a9d9ad8.tar.gz
src-c795344ff71ff37ee942ac1ace3705a58a9d9ad8.zip
locks: fix a long standing bug for primitives with kdtrace but without spinning
In such a case the second argument to lock_delay_arg_init was NULL which was immediately causing a null pointer deref. Since the sructure is only used for spin count, provide a dedicate routine initializing it. Reported by: andrew
Notes
Notes: svn path=/head/; revision=363451
Diffstat (limited to 'sys/sys/lock.h')
-rw-r--r--sys/sys/lock.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/sys/sys/lock.h b/sys/sys/lock.h
index 9dd4e642f320..e682f590985c 100644
--- a/sys/sys/lock.h
+++ b/sys/sys/lock.h
@@ -195,6 +195,13 @@ lock_delay_arg_init(struct lock_delay_arg *la, struct lock_delay_config *lc)
la->spin_cnt = 0;
}
+static inline void
+lock_delay_arg_init_noadapt(struct lock_delay_arg *la)
+{
+ la->delay = 0;
+ la->spin_cnt = 0;
+}
+
#define lock_delay_spin(n) do { \
u_int _i; \
\