Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 3644
b: refs/heads/master
c: dae4c1d
h: refs/heads/master
v: v3
  • Loading branch information
Roland Dreier authored and Linus Torvalds committed Jun 27, 2005
1 parent a3cd3c1 commit b4dab7d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: cae54bdf6f8b643e0e7a36ed531951f19e14fe56
refs/heads/master: dae4c1d2362292ccd3318ff67d18aa5c22ee820c
18 changes: 13 additions & 5 deletions trunk/drivers/infiniband/core/sa_query.c
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,13 @@ static int send_mad(struct ib_sa_query *query, int timeout_ms)
spin_unlock_irqrestore(&idr_lock, flags);
}

return ret;
/*
* It's not safe to dereference query any more, because the
* send may already have completed and freed the query in
* another context. So use wr.wr_id, which has a copy of the
* query's id.
*/
return ret ? ret : wr.wr_id;
}

static void ib_sa_path_rec_callback(struct ib_sa_query *sa_query,
Expand Down Expand Up @@ -598,14 +604,15 @@ int ib_sa_path_rec_get(struct ib_device *device, u8 port_num,
rec, query->sa_query.mad->data);

*sa_query = &query->sa_query;

ret = send_mad(&query->sa_query, timeout_ms);
if (ret) {
if (ret < 0) {
*sa_query = NULL;
kfree(query->sa_query.mad);
kfree(query);
}

return ret ? ret : query->sa_query.id;
return ret;
}
EXPORT_SYMBOL(ib_sa_path_rec_get);

Expand Down Expand Up @@ -674,14 +681,15 @@ int ib_sa_mcmember_rec_query(struct ib_device *device, u8 port_num,
rec, query->sa_query.mad->data);

*sa_query = &query->sa_query;

ret = send_mad(&query->sa_query, timeout_ms);
if (ret) {
if (ret < 0) {
*sa_query = NULL;
kfree(query->sa_query.mad);
kfree(query);
}

return ret ? ret : query->sa_query.id;
return ret;
}
EXPORT_SYMBOL(ib_sa_mcmember_rec_query);

Expand Down

0 comments on commit b4dab7d

Please sign in to comment.