diff options
author | Faisal Latif <faisal.latif@intel.com> | 2009-12-09 18:54:23 -0500 |
---|---|---|
committer | Roland Dreier <rolandd@cisco.com> | 2009-12-09 18:54:23 -0500 |
commit | fd000e12a564bdeaec5e5a438d341d9132409f26 (patch) | |
tree | 6e0a0eb3846b11d8dcb7ee8c5640b32809721bb6 /drivers/infiniband | |
parent | 886f98a31586fd560fe83c44ad72e3ebe62f8e2e (diff) |
RDMA/nes: Check for zero STag
STags are generated randomly but the driver does not correctly prevent
a zero STag. Using STag zero is privileged and causes a user space
application to fail. This change prevents the driver from trying to
allocate a zero STag.
Signed-off-by: Faisal Latif <faisal.latif@intel.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
Diffstat (limited to 'drivers/infiniband')
-rw-r--r-- | drivers/infiniband/hw/nes/nes_hw.c | 3 | ||||
-rw-r--r-- | drivers/infiniband/hw/nes/nes_verbs.c | 3 |
2 files changed, 2 insertions, 4 deletions
diff --git a/drivers/infiniband/hw/nes/nes_hw.c b/drivers/infiniband/hw/nes/nes_hw.c index 9fc0273dd409..b1c2cbb88f09 100644 --- a/drivers/infiniband/hw/nes/nes_hw.c +++ b/drivers/infiniband/hw/nes/nes_hw.c | |||
@@ -437,11 +437,12 @@ struct nes_adapter *nes_init_adapter(struct nes_device *nesdev, u8 hw_rev) { | |||
437 | nesadapter->qp_table = (struct nes_qp **)(&nesadapter->allocated_arps[BITS_TO_LONGS(arp_table_size)]); | 437 | nesadapter->qp_table = (struct nes_qp **)(&nesadapter->allocated_arps[BITS_TO_LONGS(arp_table_size)]); |
438 | 438 | ||
439 | 439 | ||
440 | /* mark the usual suspect QPs and CQs as in use */ | 440 | /* mark the usual suspect QPs, MR and CQs as in use */ |
441 | for (u32temp = 0; u32temp < NES_FIRST_QPN; u32temp++) { | 441 | for (u32temp = 0; u32temp < NES_FIRST_QPN; u32temp++) { |
442 | set_bit(u32temp, nesadapter->allocated_qps); | 442 | set_bit(u32temp, nesadapter->allocated_qps); |
443 | set_bit(u32temp, nesadapter->allocated_cqs); | 443 | set_bit(u32temp, nesadapter->allocated_cqs); |
444 | } | 444 | } |
445 | set_bit(0, nesadapter->allocated_mrs); | ||
445 | 446 | ||
446 | for (u32temp = 0; u32temp < 20; u32temp++) | 447 | for (u32temp = 0; u32temp < 20; u32temp++) |
447 | set_bit(u32temp, nesadapter->allocated_pds); | 448 | set_bit(u32temp, nesadapter->allocated_pds); |
diff --git a/drivers/infiniband/hw/nes/nes_verbs.c b/drivers/infiniband/hw/nes/nes_verbs.c index 67a87cb9d773..53dc39f43008 100644 --- a/drivers/infiniband/hw/nes/nes_verbs.c +++ b/drivers/infiniband/hw/nes/nes_verbs.c | |||
@@ -2503,9 +2503,6 @@ static struct ib_mr *nes_reg_user_mr(struct ib_pd *pd, u64 start, u64 length, | |||
2503 | stag = stag_index << 8; | 2503 | stag = stag_index << 8; |
2504 | stag |= driver_key; | 2504 | stag |= driver_key; |
2505 | stag += (u32)stag_key; | 2505 | stag += (u32)stag_key; |
2506 | if (stag == 0) { | ||
2507 | stag = 1; | ||
2508 | } | ||
2509 | 2506 | ||
2510 | iova_start = virt; | 2507 | iova_start = virt; |
2511 | /* Make the leaf PBL the root if only one PBL */ | 2508 | /* Make the leaf PBL the root if only one PBL */ |