diff options
author | Jeff Garzik <jgarzik@pobox.com> | 2005-06-27 22:50:10 -0400 |
---|---|---|
committer | Jeff Garzik <jgarzik@pobox.com> | 2005-06-27 22:50:10 -0400 |
commit | aa8f6dfd355021b4dd8b74b0588fd6fd8f21b79f (patch) | |
tree | 57ca3e27227695acbd97408eabb0f967726c3b51 /drivers/infiniband/core | |
parent | f45727d52d1581e9ff4df9d1a12a60789ad2d1eb (diff) | |
parent | 245ac8738b0b840552d56b842e70e750d65911cc (diff) | |
download | kernel_samsung_espresso10-aa8f6dfd355021b4dd8b74b0588fd6fd8f21b79f.zip kernel_samsung_espresso10-aa8f6dfd355021b4dd8b74b0588fd6fd8f21b79f.tar.gz kernel_samsung_espresso10-aa8f6dfd355021b4dd8b74b0588fd6fd8f21b79f.tar.bz2 |
Merge /spare/repo/netdev-2.6 branch 'ieee80211'
Diffstat (limited to 'drivers/infiniband/core')
-rw-r--r-- | drivers/infiniband/core/packer.c | 4 | ||||
-rw-r--r-- | drivers/infiniband/core/sa_query.c | 18 |
2 files changed, 15 insertions, 7 deletions
diff --git a/drivers/infiniband/core/packer.c b/drivers/infiniband/core/packer.c index 5f15fef..eb5ff54 100644 --- a/drivers/infiniband/core/packer.c +++ b/drivers/infiniband/core/packer.c @@ -96,7 +96,7 @@ void ib_pack(const struct ib_field *desc, else val = 0; - mask = cpu_to_be64(((1ull << desc[i].size_bits) - 1) << shift); + mask = cpu_to_be64((~0ull >> (64 - desc[i].size_bits)) << shift); addr = (__be64 *) ((__be32 *) buf + desc[i].offset_words); *addr = (*addr & ~mask) | (cpu_to_be64(val) & mask); } else { @@ -176,7 +176,7 @@ void ib_unpack(const struct ib_field *desc, __be64 *addr; shift = 64 - desc[i].offset_bits - desc[i].size_bits; - mask = ((1ull << desc[i].size_bits) - 1) << shift; + mask = (~0ull >> (64 - desc[i].size_bits)) << shift; addr = (__be64 *) buf + desc[i].offset_words; val = (be64_to_cpup(addr) & mask) >> shift; value_write(desc[i].struct_offset_bytes, diff --git a/drivers/infiniband/core/sa_query.c b/drivers/infiniband/core/sa_query.c index 276e1a5..5a08e81 100644 --- a/drivers/infiniband/core/sa_query.c +++ b/drivers/infiniband/core/sa_query.c @@ -507,7 +507,13 @@ retry: 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, @@ -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); @@ -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); |