aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorHoang-Nam Nguyen <hnguyen@de.ibm.com>2008-04-17 00:01:13 -0400
committerRoland Dreier <rolandd@cisco.com>2008-04-17 00:01:13 -0400
commitf4f82994d1ea0cd01058a245985f1eb5e569e6d3 (patch)
tree67244352967536dd4330928cd53c3e37011fa2ec /drivers
parent1e89a1946cfd906d12eff437d2a76b3aa7f5e731 (diff)
IB/ehca: Remove tgid checking
Pavel Emelyanov <xemul@openvz.org> mentioned in <http://lkml.org/lkml/2008/3/17/131> that the task_struct->tgid field is about to become deprecated, so the uses in the ehca driver need to be fixed up. However, all the uses in ehca are for some object ownership checking that is not really needed, and anyway is implementing a policy that should be in common code rather than a low-level driver. So just remove all the checks. Signed-off-by: Hoang-Nam Nguyen <hnguyen@de.ibm.com> Signed-off-by: Roland Dreier <rolandd@cisco.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/infiniband/hw/ehca/ehca_av.c31
-rw-r--r--drivers/infiniband/hw/ehca/ehca_classes.h2
-rw-r--r--drivers/infiniband/hw/ehca/ehca_cq.c19
-rw-r--r--drivers/infiniband/hw/ehca/ehca_mrmw.c32
-rw-r--r--drivers/infiniband/hw/ehca/ehca_pd.c11
-rw-r--r--drivers/infiniband/hw/ehca/ehca_qp.c48
-rw-r--r--drivers/infiniband/hw/ehca/ehca_uverbs.c19
7 files changed, 0 insertions, 162 deletions
diff --git a/drivers/infiniband/hw/ehca/ehca_av.c b/drivers/infiniband/hw/ehca/ehca_av.c
index 194c1c30cf63..56735ea2fc57 100644
--- a/drivers/infiniband/hw/ehca/ehca_av.c
+++ b/drivers/infiniband/hw/ehca/ehca_av.c
@@ -41,9 +41,6 @@
41 * POSSIBILITY OF SUCH DAMAGE. 41 * POSSIBILITY OF SUCH DAMAGE.
42 */ 42 */
43 43
44
45#include <asm/current.h>
46
47#include "ehca_tools.h" 44#include "ehca_tools.h"
48#include "ehca_iverbs.h" 45#include "ehca_iverbs.h"
49#include "hcp_if.h" 46#include "hcp_if.h"
@@ -170,17 +167,8 @@ int ehca_modify_ah(struct ib_ah *ah, struct ib_ah_attr *ah_attr)
170{ 167{
171 struct ehca_av *av; 168 struct ehca_av *av;
172 struct ehca_ud_av new_ehca_av; 169 struct ehca_ud_av new_ehca_av;
173 struct ehca_pd *my_pd = container_of(ah->pd, struct ehca_pd, ib_pd);
174 struct ehca_shca *shca = container_of(ah->pd->device, struct ehca_shca, 170 struct ehca_shca *shca = container_of(ah->pd->device, struct ehca_shca,
175 ib_device); 171 ib_device);
176 u32 cur_pid = current->tgid;
177
178 if (my_pd->ib_pd.uobject && my_pd->ib_pd.uobject->context &&
179 my_pd->ownpid != cur_pid) {
180 ehca_err(ah->device, "Invalid caller pid=%x ownpid=%x",
181 cur_pid, my_pd->ownpid);
182 return -EINVAL;
183 }
184 172
185 memset(&new_ehca_av, 0, sizeof(new_ehca_av)); 173 memset(&new_ehca_av, 0, sizeof(new_ehca_av));
186 new_ehca_av.sl = ah_attr->sl; 174 new_ehca_av.sl = ah_attr->sl;
@@ -242,15 +230,6 @@ int ehca_modify_ah(struct ib_ah *ah, struct ib_ah_attr *ah_attr)
242int ehca_query_ah(struct ib_ah *ah, struct ib_ah_attr *ah_attr) 230int ehca_query_ah(struct ib_ah *ah, struct ib_ah_attr *ah_attr)
243{ 231{
244 struct ehca_av *av = container_of(ah, struct ehca_av, ib_ah); 232 struct ehca_av *av = container_of(ah, struct ehca_av, ib_ah);
245 struct ehca_pd *my_pd = container_of(ah->pd, struct ehca_pd, ib_pd);
246 u32 cur_pid = current->tgid;
247
248 if (my_pd->ib_pd.uobject && my_pd->ib_pd.uobject->context &&
249 my_pd->ownpid != cur_pid) {
250 ehca_err(ah->device, "Invalid caller pid=%x ownpid=%x",
251 cur_pid, my_pd->ownpid);
252 return -EINVAL;
253 }
254 233
255 memcpy(&ah_attr->grh.dgid, &av->av.grh.word_3, 234 memcpy(&ah_attr->grh.dgid, &av->av.grh.word_3,
256 sizeof(ah_attr->grh.dgid)); 235 sizeof(ah_attr->grh.dgid));
@@ -273,16 +252,6 @@ int ehca_query_ah(struct ib_ah *ah, struct ib_ah_attr *ah_attr)
273 252
274int ehca_destroy_ah(struct ib_ah *ah) 253int ehca_destroy_ah(struct ib_ah *ah)
275{ 254{
276 struct ehca_pd *my_pd = container_of(ah->pd, struct ehca_pd, ib_pd);
277 u32 cur_pid = current->tgid;
278
279 if (my_pd->ib_pd.uobject && my_pd->ib_pd.uobject->context &&
280 my_pd->ownpid != cur_pid) {
281 ehca_err(ah->device, "Invalid caller pid=%x ownpid=%x",
282 cur_pid, my_pd->ownpid);
283 return -EINVAL;
284 }
285
286 kmem_cache_free(av_cache, container_of(ah, struct ehca_av, ib_ah)); 255 kmem_cache_free(av_cache, container_of(ah, struct ehca_av, ib_ah));
287 256
288 return 0; 257 return 0;
diff --git a/drivers/infiniband/hw/ehca/ehca_classes.h b/drivers/infiniband/hw/ehca/ehca_classes.h
index 92cce8aacbb7..0d13fe0a260b 100644
--- a/drivers/infiniband/hw/ehca/ehca_classes.h
+++ b/drivers/infiniband/hw/ehca/ehca_classes.h
@@ -132,7 +132,6 @@ struct ehca_shca {
132struct ehca_pd { 132struct ehca_pd {
133 struct ib_pd ib_pd; 133 struct ib_pd ib_pd;
134 struct ipz_pd fw_pd; 134 struct ipz_pd fw_pd;
135 u32 ownpid;
136 /* small queue mgmt */ 135 /* small queue mgmt */
137 struct mutex lock; 136 struct mutex lock;
138 struct list_head free[2]; 137 struct list_head free[2];
@@ -215,7 +214,6 @@ struct ehca_cq {
215 atomic_t nr_events; /* #events seen */ 214 atomic_t nr_events; /* #events seen */
216 wait_queue_head_t wait_completion; 215 wait_queue_head_t wait_completion;
217 spinlock_t task_lock; 216 spinlock_t task_lock;
218 u32 ownpid;
219 /* mmap counter for resources mapped into user space */ 217 /* mmap counter for resources mapped into user space */
220 u32 mm_count_queue; 218 u32 mm_count_queue;
221 u32 mm_count_galpa; 219 u32 mm_count_galpa;
diff --git a/drivers/infiniband/hw/ehca/ehca_cq.c b/drivers/infiniband/hw/ehca/ehca_cq.c
index 0467c158d4a9..ec0cfcf3073f 100644
--- a/drivers/infiniband/hw/ehca/ehca_cq.c
+++ b/drivers/infiniband/hw/ehca/ehca_cq.c
@@ -43,8 +43,6 @@
43 * POSSIBILITY OF SUCH DAMAGE. 43 * POSSIBILITY OF SUCH DAMAGE.
44 */ 44 */
45 45
46#include <asm/current.h>
47
48#include "ehca_iverbs.h" 46#include "ehca_iverbs.h"
49#include "ehca_classes.h" 47#include "ehca_classes.h"
50#include "ehca_irq.h" 48#include "ehca_irq.h"
@@ -148,7 +146,6 @@ struct ib_cq *ehca_create_cq(struct ib_device *device, int cqe, int comp_vector,
148 spin_lock_init(&my_cq->task_lock); 146 spin_lock_init(&my_cq->task_lock);
149 atomic_set(&my_cq->nr_events, 0); 147 atomic_set(&my_cq->nr_events, 0);
150 init_waitqueue_head(&my_cq->wait_completion); 148 init_waitqueue_head(&my_cq->wait_completion);
151 my_cq->ownpid = current->tgid;
152 149
153 cq = &my_cq->ib_cq; 150 cq = &my_cq->ib_cq;
154 151
@@ -320,7 +317,6 @@ int ehca_destroy_cq(struct ib_cq *cq)
320 struct ehca_shca *shca = container_of(device, struct ehca_shca, 317 struct ehca_shca *shca = container_of(device, struct ehca_shca,
321 ib_device); 318 ib_device);
322 struct ipz_adapter_handle adapter_handle = shca->ipz_hca_handle; 319 struct ipz_adapter_handle adapter_handle = shca->ipz_hca_handle;
323 u32 cur_pid = current->tgid;
324 unsigned long flags; 320 unsigned long flags;
325 321
326 if (cq->uobject) { 322 if (cq->uobject) {
@@ -329,12 +325,6 @@ int ehca_destroy_cq(struct ib_cq *cq)
329 "user space cq_num=%x", my_cq->cq_number); 325 "user space cq_num=%x", my_cq->cq_number);
330 return -EINVAL; 326 return -EINVAL;
331 } 327 }
332 if (my_cq->ownpid != cur_pid) {
333 ehca_err(device, "Invalid caller pid=%x ownpid=%x "
334 "cq_num=%x",
335 cur_pid, my_cq->ownpid, my_cq->cq_number);
336 return -EINVAL;
337 }
338 } 328 }
339 329
340 /* 330 /*
@@ -374,15 +364,6 @@ int ehca_destroy_cq(struct ib_cq *cq)
374 364
375int ehca_resize_cq(struct ib_cq *cq, int cqe, struct ib_udata *udata) 365int ehca_resize_cq(struct ib_cq *cq, int cqe, struct ib_udata *udata)
376{ 366{
377 struct ehca_cq *my_cq = container_of(cq, struct ehca_cq, ib_cq);
378 u32 cur_pid = current->tgid;
379
380 if (cq->uobject && my_cq->ownpid != cur_pid) {
381 ehca_err(cq->device, "Invalid caller pid=%x ownpid=%x",
382 cur_pid, my_cq->ownpid);
383 return -EINVAL;
384 }
385
386 /* TODO: proper resize needs to be done */ 367 /* TODO: proper resize needs to be done */
387 ehca_err(cq->device, "not implemented yet"); 368 ehca_err(cq->device, "not implemented yet");
388 369
diff --git a/drivers/infiniband/hw/ehca/ehca_mrmw.c b/drivers/infiniband/hw/ehca/ehca_mrmw.c
index 5e99c45493c1..f26997fc00f8 100644
--- a/drivers/infiniband/hw/ehca/ehca_mrmw.c
+++ b/drivers/infiniband/hw/ehca/ehca_mrmw.c
@@ -40,8 +40,6 @@
40 * POSSIBILITY OF SUCH DAMAGE. 40 * POSSIBILITY OF SUCH DAMAGE.
41 */ 41 */
42 42
43#include <asm/current.h>
44
45#include <rdma/ib_umem.h> 43#include <rdma/ib_umem.h>
46 44
47#include "ehca_iverbs.h" 45#include "ehca_iverbs.h"
@@ -419,7 +417,6 @@ int ehca_rereg_phys_mr(struct ib_mr *mr,
419 struct ehca_shca *shca = 417 struct ehca_shca *shca =
420 container_of(mr->device, struct ehca_shca, ib_device); 418 container_of(mr->device, struct ehca_shca, ib_device);
421 struct ehca_mr *e_mr = container_of(mr, struct ehca_mr, ib.ib_mr); 419 struct ehca_mr *e_mr = container_of(mr, struct ehca_mr, ib.ib_mr);
422 struct ehca_pd *my_pd = container_of(mr->pd, struct ehca_pd, ib_pd);
423 u64 new_size; 420 u64 new_size;
424 u64 *new_start; 421 u64 *new_start;
425 u32 new_acl; 422 u32 new_acl;
@@ -429,15 +426,6 @@ int ehca_rereg_phys_mr(struct ib_mr *mr,
429 u32 num_kpages = 0; 426 u32 num_kpages = 0;
430 u32 num_hwpages = 0; 427 u32 num_hwpages = 0;
431 struct ehca_mr_pginfo pginfo; 428 struct ehca_mr_pginfo pginfo;
432 u32 cur_pid = current->tgid;
433
434 if (my_pd->ib_pd.uobject && my_pd->ib_pd.uobject->context &&
435 (my_pd->ownpid != cur_pid)) {
436 ehca_err(mr->device, "Invalid caller pid=%x ownpid=%x",
437 cur_pid, my_pd->ownpid);
438 ret = -EINVAL;
439 goto rereg_phys_mr_exit0;
440 }
441 429
442 if (!(mr_rereg_mask & IB_MR_REREG_TRANS)) { 430 if (!(mr_rereg_mask & IB_MR_REREG_TRANS)) {
443 /* TODO not supported, because PHYP rereg hCall needs pages */ 431 /* TODO not supported, because PHYP rereg hCall needs pages */
@@ -577,19 +565,9 @@ int ehca_query_mr(struct ib_mr *mr, struct ib_mr_attr *mr_attr)
577 struct ehca_shca *shca = 565 struct ehca_shca *shca =
578 container_of(mr->device, struct ehca_shca, ib_device); 566 container_of(mr->device, struct ehca_shca, ib_device);
579 struct ehca_mr *e_mr = container_of(mr, struct ehca_mr, ib.ib_mr); 567 struct ehca_mr *e_mr = container_of(mr, struct ehca_mr, ib.ib_mr);
580 struct ehca_pd *my_pd = container_of(mr->pd, struct ehca_pd, ib_pd);
581 u32 cur_pid = current->tgid;
582 unsigned long sl_flags; 568 unsigned long sl_flags;
583 struct ehca_mr_hipzout_parms hipzout; 569 struct ehca_mr_hipzout_parms hipzout;
584 570
585 if (my_pd->ib_pd.uobject && my_pd->ib_pd.uobject->context &&
586 (my_pd->ownpid != cur_pid)) {
587 ehca_err(mr->device, "Invalid caller pid=%x ownpid=%x",
588 cur_pid, my_pd->ownpid);
589 ret = -EINVAL;
590 goto query_mr_exit0;
591 }
592
593 if ((e_mr->flags & EHCA_MR_FLAG_FMR)) { 571 if ((e_mr->flags & EHCA_MR_FLAG_FMR)) {
594 ehca_err(mr->device, "not supported for FMR, mr=%p e_mr=%p " 572 ehca_err(mr->device, "not supported for FMR, mr=%p e_mr=%p "
595 "e_mr->flags=%x", mr, e_mr, e_mr->flags); 573 "e_mr->flags=%x", mr, e_mr, e_mr->flags);
@@ -634,16 +612,6 @@ int ehca_dereg_mr(struct ib_mr *mr)
634 struct ehca_shca *shca = 612 struct ehca_shca *shca =
635 container_of(mr->device, struct ehca_shca, ib_device); 613 container_of(mr->device, struct ehca_shca, ib_device);
636 struct ehca_mr *e_mr = container_of(mr, struct ehca_mr, ib.ib_mr); 614 struct ehca_mr *e_mr = container_of(mr, struct ehca_mr, ib.ib_mr);
637 struct ehca_pd *my_pd = container_of(mr->pd, struct ehca_pd, ib_pd);
638 u32 cur_pid = current->tgid;
639
640 if (my_pd->ib_pd.uobject && my_pd->ib_pd.uobject->context &&
641 (my_pd->ownpid != cur_pid)) {
642 ehca_err(mr->device, "Invalid caller pid=%x ownpid=%x",
643 cur_pid, my_pd->ownpid);
644 ret = -EINVAL;
645 goto dereg_mr_exit0;
646 }
647 615
648 if ((e_mr->flags & EHCA_MR_FLAG_FMR)) { 616 if ((e_mr->flags & EHCA_MR_FLAG_FMR)) {
649 ehca_err(mr->device, "not supported for FMR, mr=%p e_mr=%p " 617 ehca_err(mr->device, "not supported for FMR, mr=%p e_mr=%p "
diff --git a/drivers/infiniband/hw/ehca/ehca_pd.c b/drivers/infiniband/hw/ehca/ehca_pd.c
index 43bcf085fcf2..2fe554855fa5 100644
--- a/drivers/infiniband/hw/ehca/ehca_pd.c
+++ b/drivers/infiniband/hw/ehca/ehca_pd.c
@@ -38,8 +38,6 @@
38 * POSSIBILITY OF SUCH DAMAGE. 38 * POSSIBILITY OF SUCH DAMAGE.
39 */ 39 */
40 40
41#include <asm/current.h>
42
43#include "ehca_tools.h" 41#include "ehca_tools.h"
44#include "ehca_iverbs.h" 42#include "ehca_iverbs.h"
45 43
@@ -58,7 +56,6 @@ struct ib_pd *ehca_alloc_pd(struct ib_device *device,
58 return ERR_PTR(-ENOMEM); 56 return ERR_PTR(-ENOMEM);
59 } 57 }
60 58
61 pd->ownpid = current->tgid;
62 for (i = 0; i < 2; i++) { 59 for (i = 0; i < 2; i++) {
63 INIT_LIST_HEAD(&pd->free[i]); 60 INIT_LIST_HEAD(&pd->free[i]);
64 INIT_LIST_HEAD(&pd->full[i]); 61 INIT_LIST_HEAD(&pd->full[i]);
@@ -85,18 +82,10 @@ struct ib_pd *ehca_alloc_pd(struct ib_device *device,
85 82
86int ehca_dealloc_pd(struct ib_pd *pd) 83int ehca_dealloc_pd(struct ib_pd *pd)
87{ 84{
88 u32 cur_pid = current->tgid;
89 struct ehca_pd *my_pd = container_of(pd, struct ehca_pd, ib_pd); 85 struct ehca_pd *my_pd = container_of(pd, struct ehca_pd, ib_pd);
90 int i, leftovers = 0; 86 int i, leftovers = 0;
91 struct ipz_small_queue_page *page, *tmp; 87 struct ipz_small_queue_page *page, *tmp;
92 88
93 if (my_pd->ib_pd.uobject && my_pd->ib_pd.uobject->context &&
94 my_pd->ownpid != cur_pid) {
95 ehca_err(pd->device, "Invalid caller pid=%x ownpid=%x",
96 cur_pid, my_pd->ownpid);
97 return -EINVAL;
98 }
99
100 for (i = 0; i < 2; i++) { 89 for (i = 0; i < 2; i++) {
101 list_splice(&my_pd->full[i], &my_pd->free[i]); 90 list_splice(&my_pd->full[i], &my_pd->free[i]);
102 list_for_each_entry_safe(page, tmp, &my_pd->free[i], list) { 91 list_for_each_entry_safe(page, tmp, &my_pd->free[i], list) {
diff --git a/drivers/infiniband/hw/ehca/ehca_qp.c b/drivers/infiniband/hw/ehca/ehca_qp.c
index 1012f15a7140..a9fd419855cb 100644
--- a/drivers/infiniband/hw/ehca/ehca_qp.c
+++ b/drivers/infiniband/hw/ehca/ehca_qp.c
@@ -43,9 +43,6 @@
43 * POSSIBILITY OF SUCH DAMAGE. 43 * POSSIBILITY OF SUCH DAMAGE.
44 */ 44 */
45 45
46
47#include <asm/current.h>
48
49#include "ehca_classes.h" 46#include "ehca_classes.h"
50#include "ehca_tools.h" 47#include "ehca_tools.h"
51#include "ehca_qes.h" 48#include "ehca_qes.h"
@@ -1526,16 +1523,6 @@ int ehca_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, int attr_mask,
1526 struct ehca_shca *shca = container_of(ibqp->device, struct ehca_shca, 1523 struct ehca_shca *shca = container_of(ibqp->device, struct ehca_shca,
1527 ib_device); 1524 ib_device);
1528 struct ehca_qp *my_qp = container_of(ibqp, struct ehca_qp, ib_qp); 1525 struct ehca_qp *my_qp = container_of(ibqp, struct ehca_qp, ib_qp);
1529 struct ehca_pd *my_pd = container_of(my_qp->ib_qp.pd, struct ehca_pd,
1530 ib_pd);
1531 u32 cur_pid = current->tgid;
1532
1533 if (my_pd->ib_pd.uobject && my_pd->ib_pd.uobject->context &&
1534 my_pd->ownpid != cur_pid) {
1535 ehca_err(ibqp->pd->device, "Invalid caller pid=%x ownpid=%x",
1536 cur_pid, my_pd->ownpid);
1537 return -EINVAL;
1538 }
1539 1526
1540 /* The if-block below caches qp_attr to be modified for GSI and SMI 1527 /* The if-block below caches qp_attr to be modified for GSI and SMI
1541 * qps during the initialization by ib_mad. When the respective port 1528 * qps during the initialization by ib_mad. When the respective port
@@ -1636,23 +1623,13 @@ int ehca_query_qp(struct ib_qp *qp,
1636 int qp_attr_mask, struct ib_qp_init_attr *qp_init_attr) 1623 int qp_attr_mask, struct ib_qp_init_attr *qp_init_attr)
1637{ 1624{
1638 struct ehca_qp *my_qp = container_of(qp, struct ehca_qp, ib_qp); 1625 struct ehca_qp *my_qp = container_of(qp, struct ehca_qp, ib_qp);
1639 struct ehca_pd *my_pd = container_of(my_qp->ib_qp.pd, struct ehca_pd,
1640 ib_pd);
1641 struct ehca_shca *shca = container_of(qp->device, struct ehca_shca, 1626 struct ehca_shca *shca = container_of(qp->device, struct ehca_shca,
1642 ib_device); 1627 ib_device);
1643 struct ipz_adapter_handle adapter_handle = shca->ipz_hca_handle; 1628 struct ipz_adapter_handle adapter_handle = shca->ipz_hca_handle;
1644 struct hcp_modify_qp_control_block *qpcb; 1629 struct hcp_modify_qp_control_block *qpcb;
1645 u32 cur_pid = current->tgid;
1646 int cnt, ret = 0; 1630 int cnt, ret = 0;
1647 u64 h_ret; 1631 u64 h_ret;
1648 1632
1649 if (my_pd->ib_pd.uobject && my_pd->ib_pd.uobject->context &&
1650 my_pd->ownpid != cur_pid) {
1651 ehca_err(qp->device, "Invalid caller pid=%x ownpid=%x",
1652 cur_pid, my_pd->ownpid);
1653 return -EINVAL;
1654 }
1655
1656 if (qp_attr_mask & QP_ATTR_QUERY_NOT_SUPPORTED) { 1633 if (qp_attr_mask & QP_ATTR_QUERY_NOT_SUPPORTED) {
1657 ehca_err(qp->device, "Invalid attribute mask " 1634 ehca_err(qp->device, "Invalid attribute mask "
1658 "ehca_qp=%p qp_num=%x qp_attr_mask=%x ", 1635 "ehca_qp=%p qp_num=%x qp_attr_mask=%x ",
@@ -1797,8 +1774,6 @@ int ehca_modify_srq(struct ib_srq *ibsrq, struct ib_srq_attr *attr,
1797{ 1774{
1798 struct ehca_qp *my_qp = 1775 struct ehca_qp *my_qp =
1799 container_of(ibsrq, struct ehca_qp, ib_srq); 1776 container_of(ibsrq, struct ehca_qp, ib_srq);
1800 struct ehca_pd *my_pd =
1801 container_of(ibsrq->pd, struct ehca_pd, ib_pd);
1802 struct ehca_shca *shca = 1777 struct ehca_shca *shca =
1803 container_of(ibsrq->pd->device, struct ehca_shca, ib_device); 1778 container_of(ibsrq->pd->device, struct ehca_shca, ib_device);
1804 struct hcp_modify_qp_control_block *mqpcb; 1779 struct hcp_modify_qp_control_block *mqpcb;
@@ -1806,14 +1781,6 @@ int ehca_modify_srq(struct ib_srq *ibsrq, struct ib_srq_attr *attr,
1806 u64 h_ret; 1781 u64 h_ret;
1807 int ret = 0; 1782 int ret = 0;
1808 1783
1809 u32 cur_pid = current->tgid;
1810 if (my_pd->ib_pd.uobject && my_pd->ib_pd.uobject->context &&
1811 my_pd->ownpid != cur_pid) {
1812 ehca_err(ibsrq->pd->device, "Invalid caller pid=%x ownpid=%x",
1813 cur_pid, my_pd->ownpid);
1814 return -EINVAL;
1815 }
1816
1817 mqpcb = ehca_alloc_fw_ctrlblock(GFP_KERNEL); 1784 mqpcb = ehca_alloc_fw_ctrlblock(GFP_KERNEL);
1818 if (!mqpcb) { 1785 if (!mqpcb) {
1819 ehca_err(ibsrq->device, "Could not get zeroed page for mqpcb " 1786 ehca_err(ibsrq->device, "Could not get zeroed page for mqpcb "
@@ -1864,22 +1831,13 @@ modify_srq_exit0:
1864int ehca_query_srq(struct ib_srq *srq, struct ib_srq_attr *srq_attr) 1831int ehca_query_srq(struct ib_srq *srq, struct ib_srq_attr *srq_attr)
1865{ 1832{
1866 struct ehca_qp *my_qp = container_of(srq, struct ehca_qp, ib_srq); 1833 struct ehca_qp *my_qp = container_of(srq, struct ehca_qp, ib_srq);
1867 struct ehca_pd *my_pd = container_of(srq->pd, struct ehca_pd, ib_pd);
1868 struct ehca_shca *shca = container_of(srq->device, struct ehca_shca, 1834 struct ehca_shca *shca = container_of(srq->device, struct ehca_shca,
1869 ib_device); 1835 ib_device);
1870 struct ipz_adapter_handle adapter_handle = shca->ipz_hca_handle; 1836 struct ipz_adapter_handle adapter_handle = shca->ipz_hca_handle;
1871 struct hcp_modify_qp_control_block *qpcb; 1837 struct hcp_modify_qp_control_block *qpcb;
1872 u32 cur_pid = current->tgid;
1873 int ret = 0; 1838 int ret = 0;
1874 u64 h_ret; 1839 u64 h_ret;
1875 1840
1876 if (my_pd->ib_pd.uobject && my_pd->ib_pd.uobject->context &&
1877 my_pd->ownpid != cur_pid) {
1878 ehca_err(srq->device, "Invalid caller pid=%x ownpid=%x",
1879 cur_pid, my_pd->ownpid);
1880 return -EINVAL;
1881 }
1882
1883 qpcb = ehca_alloc_fw_ctrlblock(GFP_KERNEL); 1841 qpcb = ehca_alloc_fw_ctrlblock(GFP_KERNEL);
1884 if (!qpcb) { 1842 if (!qpcb) {
1885 ehca_err(srq->device, "Out of memory for qpcb " 1843 ehca_err(srq->device, "Out of memory for qpcb "
@@ -1919,7 +1877,6 @@ static int internal_destroy_qp(struct ib_device *dev, struct ehca_qp *my_qp,
1919 struct ehca_pd *my_pd = container_of(my_qp->ib_qp.pd, struct ehca_pd, 1877 struct ehca_pd *my_pd = container_of(my_qp->ib_qp.pd, struct ehca_pd,
1920 ib_pd); 1878 ib_pd);
1921 struct ehca_sport *sport = &shca->sport[my_qp->init_attr.port_num - 1]; 1879 struct ehca_sport *sport = &shca->sport[my_qp->init_attr.port_num - 1];
1922 u32 cur_pid = current->tgid;
1923 u32 qp_num = my_qp->real_qp_num; 1880 u32 qp_num = my_qp->real_qp_num;
1924 int ret; 1881 int ret;
1925 u64 h_ret; 1882 u64 h_ret;
@@ -1934,11 +1891,6 @@ static int internal_destroy_qp(struct ib_device *dev, struct ehca_qp *my_qp,
1934 "user space qp_num=%x", qp_num); 1891 "user space qp_num=%x", qp_num);
1935 return -EINVAL; 1892 return -EINVAL;
1936 } 1893 }
1937 if (my_pd->ownpid != cur_pid) {
1938 ehca_err(dev, "Invalid caller pid=%x ownpid=%x",
1939 cur_pid, my_pd->ownpid);
1940 return -EINVAL;
1941 }
1942 } 1894 }
1943 1895
1944 if (my_qp->send_cq) { 1896 if (my_qp->send_cq) {
diff --git a/drivers/infiniband/hw/ehca/ehca_uverbs.c b/drivers/infiniband/hw/ehca/ehca_uverbs.c
index 5234d6c15c49..1b07f2beafaf 100644
--- a/drivers/infiniband/hw/ehca/ehca_uverbs.c
+++ b/drivers/infiniband/hw/ehca/ehca_uverbs.c
@@ -40,8 +40,6 @@
40 * POSSIBILITY OF SUCH DAMAGE. 40 * POSSIBILITY OF SUCH DAMAGE.
41 */ 41 */
42 42
43#include <asm/current.h>
44
45#include "ehca_classes.h" 43#include "ehca_classes.h"
46#include "ehca_iverbs.h" 44#include "ehca_iverbs.h"
47#include "ehca_mrmw.h" 45#include "ehca_mrmw.h"
@@ -253,11 +251,9 @@ int ehca_mmap(struct ib_ucontext *context, struct vm_area_struct *vma)
253 u32 idr_handle = fileoffset & 0x1FFFFFF; 251 u32 idr_handle = fileoffset & 0x1FFFFFF;
254 u32 q_type = (fileoffset >> 27) & 0x1; /* CQ, QP,... */ 252 u32 q_type = (fileoffset >> 27) & 0x1; /* CQ, QP,... */
255 u32 rsrc_type = (fileoffset >> 25) & 0x3; /* sq,rq,cmnd_window */ 253 u32 rsrc_type = (fileoffset >> 25) & 0x3; /* sq,rq,cmnd_window */
256 u32 cur_pid = current->tgid;
257 u32 ret; 254 u32 ret;
258 struct ehca_cq *cq; 255 struct ehca_cq *cq;
259 struct ehca_qp *qp; 256 struct ehca_qp *qp;
260 struct ehca_pd *pd;
261 struct ib_uobject *uobject; 257 struct ib_uobject *uobject;
262 258
263 switch (q_type) { 259 switch (q_type) {
@@ -270,13 +266,6 @@ int ehca_mmap(struct ib_ucontext *context, struct vm_area_struct *vma)
270 if (!cq) 266 if (!cq)
271 return -EINVAL; 267 return -EINVAL;
272 268
273 if (cq->ownpid != cur_pid) {
274 ehca_err(cq->ib_cq.device,
275 "Invalid caller pid=%x ownpid=%x",
276 cur_pid, cq->ownpid);
277 return -ENOMEM;
278 }
279
280 if (!cq->ib_cq.uobject || cq->ib_cq.uobject->context != context) 269 if (!cq->ib_cq.uobject || cq->ib_cq.uobject->context != context)
281 return -EINVAL; 270 return -EINVAL;
282 271
@@ -298,14 +287,6 @@ int ehca_mmap(struct ib_ucontext *context, struct vm_area_struct *vma)
298 if (!qp) 287 if (!qp)
299 return -EINVAL; 288 return -EINVAL;
300 289
301 pd = container_of(qp->ib_qp.pd, struct ehca_pd, ib_pd);
302 if (pd->ownpid != cur_pid) {
303 ehca_err(qp->ib_qp.device,
304 "Invalid caller pid=%x ownpid=%x",
305 cur_pid, pd->ownpid);
306 return -ENOMEM;
307 }
308
309 uobject = IS_SRQ(qp) ? qp->ib_srq.uobject : qp->ib_qp.uobject; 290 uobject = IS_SRQ(qp) ? qp->ib_srq.uobject : qp->ib_qp.uobject;
310 if (!uobject || uobject->context != context) 291 if (!uobject || uobject->context != context)
311 return -EINVAL; 292 return -EINVAL;