summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorae <ae@FreeBSD.org>2015-11-25 07:14:58 +0000
committerae <ae@FreeBSD.org>2015-11-25 07:14:58 +0000
commitda001d5bf7a7acfef070a8f605c3ec452d374d09 (patch)
treeda9d4b6ba7cf2e2ad4a8adaad580fd039149d813
parentdc18eb23e2b461aebbacdff96e2349bca5a82de6 (diff)
downloadFreeBSD-src-da001d5bf7a7acfef070a8f605c3ec452d374d09.zip
FreeBSD-src-da001d5bf7a7acfef070a8f605c3ec452d374d09.tar.gz
Check that hhk_helper pointer isn't NULL before access.
It isn't forbidden to use NULL pointer for hook_helper in hookinfo structure when hhook_add_hook() adds new helper hook.
-rw-r--r--sys/kern/kern_hhook.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/sys/kern/kern_hhook.c b/sys/kern/kern_hhook.c
index 321e1a9..12410cb 100644
--- a/sys/kern/kern_hhook.c
+++ b/sys/kern/kern_hhook.c
@@ -101,7 +101,8 @@ hhook_run_hooks(struct hhook_head *hhh, void *ctx_data, struct osd *hosd)
HHH_RLOCK(hhh, &rmpt);
STAILQ_FOREACH(hhk, &hhh->hhh_hooks, hhk_next) {
- if (hhk->hhk_helper->h_flags & HELPER_NEEDS_OSD) {
+ if (hhk->hhk_helper != NULL &&
+ hhk->hhk_helper->h_flags & HELPER_NEEDS_OSD) {
hdata = osd_get(OSD_KHELP, hosd, hhk->hhk_helper->h_id);
if (hdata == NULL)
continue;
OpenPOWER on IntegriCloud