Commit 0293a509405dccecc30783a5d729d615b68d6a77

Authored by mochel@digitalimplant.org
Committed by Greg Kroah-Hartman
1 parent 0956af53af

[PATCH] Don't reference NULL klist pointer in klist_remove().

Signed-off-by: Patrick Mochel <mochel@digitalimplant.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

diff -Nru a/lib/klist.c b/lib/klist.c

Showing 1 changed file with 3 additions and 2 deletions Side-by-side Diff

... ... @@ -145,9 +145,10 @@
145 145  
146 146 void klist_remove(struct klist_node * n)
147 147 {
148   - spin_lock(&n->n_klist->k_lock);
  148 + struct klist * k = n->n_klist;
  149 + spin_lock(&k->k_lock);
149 150 klist_dec_and_del(n);
150   - spin_unlock(&n->n_klist->k_lock);
  151 + spin_unlock(&k->k_lock);
151 152 wait_for_completion(&n->n_removed);
152 153 }
153 154