[ofa-general] [PATCH] IB/core - ib_sa_remove_one() can panic due to NULL pointer dereference
Ralph Campbell
ralph.campbell at qlogic.com
Wed Jul 16 15:33:13 PDT 2008
If an HCA does not get a SM LID, ib_sa_remove_one() can cause a NULL
pointer bug when it calls kref_put(). This is easy to see since
ib_sa_add_one() sets sm_ah to NULL.
Signed-off-by: Ralph Campbell <ralph.campbell at qlogic.com>
---
drivers/infiniband/core/sa_query.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/drivers/infiniband/core/sa_query.c b/drivers/infiniband/core/sa_query.c
index 1341de7..7863a50 100644
--- a/drivers/infiniband/core/sa_query.c
+++ b/drivers/infiniband/core/sa_query.c
@@ -1064,7 +1064,8 @@ static void ib_sa_remove_one(struct ib_device *device)
for (i = 0; i <= sa_dev->end_port - sa_dev->start_port; ++i) {
ib_unregister_mad_agent(sa_dev->port[i].agent);
- kref_put(&sa_dev->port[i].sm_ah->ref, free_sm_ah);
+ if (sa_dev->port[i].sm_ah)
+ kref_put(&sa_dev->port[i].sm_ah->ref, free_sm_ah);
}
kfree(sa_dev);
More information about the general
mailing list