kernel - Fix LWKT_TOKEN_HELD() assertion
authorMatthew Dillon <dillon@apollo.backplane.com>
Wed, 25 Aug 2010 16:35:58 +0000 (09:35 -0700)
committerMatthew Dillon <dillon@apollo.backplane.com>
Wed, 25 Aug 2010 16:35:58 +0000 (09:35 -0700)
* Fix a null pointer dereference in ASSERT_LWKT_TOKEN_HELD().

Reported-by: alexh
sys/sys/thread.h

index c31ccca..ca8b2a0 100644 (file)
@@ -129,7 +129,7 @@ typedef struct lwkt_token {
 }
 
 #define ASSERT_LWKT_TOKEN_HELD(tok) \
-       KKASSERT((tok)->t_ref->tr_owner == curthread)
+       KKASSERT((tok)->t_ref && (tok)->t_ref->tr_owner == curthread)
 
 struct lwkt_tokref {
     lwkt_token_t       tr_tok;         /* token in question */