diff options
author | kib <kib@FreeBSD.org> | 2014-11-13 17:44:35 +0000 |
---|---|---|
committer | kib <kib@FreeBSD.org> | 2014-11-13 17:44:35 +0000 |
commit | 6cedba80db2d89362880d0bc650f5ee44739ab51 (patch) | |
tree | badf7b98e6b928a2d3fbd57ec6c7191b1bff1725 /sys | |
parent | e257542e113f6ae0cd6d02b9467ae160bfbecf36 (diff) | |
download | FreeBSD-src-6cedba80db2d89362880d0bc650f5ee44739ab51.zip FreeBSD-src-6cedba80db2d89362880d0bc650f5ee44739ab51.tar.gz |
Do not try to dereference thread pointer when the value is not a pointer.
Reported and tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Diffstat (limited to 'sys')
-rw-r--r-- | sys/kern/kern_lock.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/sys/kern/kern_lock.c b/sys/kern/kern_lock.c index 3fc151d..36a8470 100644 --- a/sys/kern/kern_lock.c +++ b/sys/kern/kern_lock.c @@ -1360,9 +1360,14 @@ lockmgr_printinfo(const struct lock *lk) (uintmax_t)LK_SHARERS(lk->lk_lock)); else { td = lockmgr_xholder(lk); - printf("lock type %s: EXCL by thread %p " - "(pid %d, %s, tid %d)\n", lk->lock_object.lo_name, td, - td->td_proc->p_pid, td->td_proc->p_comm, td->td_tid); + if (td == (struct thread *)LK_KERNPROC) + printf("lock type %s: EXCL by KERNPROC\n", + lk->lock_object.lo_name); + else + printf("lock type %s: EXCL by thread %p " + "(pid %d, %s, tid %d)\n", lk->lock_object.lo_name, + td, td->td_proc->p_pid, td->td_proc->p_comm, + td->td_tid); } x = lk->lk_lock; |