Home Home > GIT Browse
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolai Stange <nstange@suse.de>2018-05-11 16:30:10 +0200
committerMiroslav Benes <mbenes@suse.cz>2018-05-14 13:02:53 +0200
commit1ff8a8c400f0f3f3c9c71e279f8d77fe1ed38d37 (patch)
tree1bd764b97f9fc85c3a1b1c025d208b3735f0ed80
parentfbe8e8ed301864b7f4a624a44bb1649ddae65bbf (diff)
callbacks: kgr_subpatch_register(): always set ->parent
In case kgr_subpatch_register() finds an existing instance of that subpatch ID, the to be registered subpatch's ->parent is not set. This causes a NULL pointer dereference from kgr_subpatch_unregister() later on. Fix this by making kgr_patch_register() always set ->parent. Signed-off-by: Nicolai Stange <nstange@suse.de> Signed-off-by: Miroslav Benes <mbenes@suse.cz>
-rw-r--r--patch_state.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/patch_state.c b/patch_state.c
index 2848e99..89629bf 100644
--- a/patch_state.c
+++ b/patch_state.c
@@ -147,9 +147,9 @@ int kgr_subpatch_register(unsigned long id, struct kgr_subpatch *subpatch)
subpatch_state->id = id;
INIT_LIST_HEAD(&subpatch_state->subpatches);
list_add(&subpatch_state->list, &kgr_patch_states->subpatch_states);
- subpatch->parent = subpatch_state;
add_to_list:
+ subpatch->parent = subpatch_state;
list_add(&subpatch->list, &subpatch_state->subpatches);
mutex_unlock(&kgr_patch_states->mutex);
return 0;