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

From: Greg KH
Date: Mon Jun 20 2005 - 22:18:21 EST


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

Signed-off-by: Patrick Mochel <mochel@xxxxxxxxxxxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxx>

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

---
commit 0293a509405dccecc30783a5d729d615b68d6a77
tree 69856eefdaba010e35dd7fbe2e5bb152a110d186
parent 0956af53afea290c5676c75249fc2c180d831375
author mochel@xxxxxxxxxxxxxxxxxx <mochel@xxxxxxxxxxxxxxxxxx> Thu, 24 Mar 2005 18:59:59 -0800
committer Greg Kroah-Hartman <gregkh@xxxxxxx> Mon, 20 Jun 2005 15:15:19 -0700

lib/klist.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/lib/klist.c b/lib/klist.c
--- a/lib/klist.c
+++ b/lib/klist.c
@@ -145,9 +145,10 @@ EXPORT_SYMBOL_GPL(klist_del);

void klist_remove(struct klist_node * n)
{
- spin_lock(&n->n_klist->k_lock);
+ struct klist * k = n->n_klist;
+ spin_lock(&k->k_lock);
klist_dec_and_del(n);
- spin_unlock(&n->n_klist->k_lock);
+ spin_unlock(&k->k_lock);
wait_for_completion(&n->n_removed);
}


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/