Don't call the watch callback if its NULL.

I'm not sure what series of events is leading up to this watch event
being received with no callback info and it should be investigated.
I'm triggering it somehow by registering an RTC device (which will
show up in a subsequent commit.)
This commit is contained in:
Adrian Chadd 2009-05-28 04:03:16 +00:00
parent cc79e34966
commit 1fc05890ae
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=192951

View File

@ -769,10 +769,17 @@ xenwatch_thread(void *unused)
mtx_unlock(&watch_events_lock);
if (msg != NULL) {
msg->u.watch.handle->callback(
msg->u.watch.handle,
(const char **)msg->u.watch.vec,
msg->u.watch.vec_size);
/*
* XXX There are messages coming in with a NULL callback.
* XXX This deserves further investigation; the workaround
* XXX here simply prevents the kernel from panic'ing
* XXX on startup.
*/
if (msg->u.watch.handle->callback != NULL)
msg->u.watch.handle->callback(
msg->u.watch.handle,
(const char **)msg->u.watch.vec,
msg->u.watch.vec_size);
free(msg->u.watch.vec, M_DEVBUF);
free(msg, M_DEVBUF);
}