]> err.no Git - linux-2.6/blobdiff - drivers/infiniband/hw/ipath/ipath_keys.c
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
[linux-2.6] / drivers / infiniband / hw / ipath / ipath_keys.c
index c93fa2f7719c32b298eff5fda04035db821f1df0..8f32b17a5eed019d304a4b3c4283019274e69170 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006 QLogic, Inc. All rights reserved.
+ * Copyright (c) 2006, 2007 QLogic Corporation. All rights reserved.
  * Copyright (c) 2005, 2006 PathScale, Inc. All rights reserved.
  *
  * This software is available to you under a choice of one of two
@@ -128,11 +128,16 @@ int ipath_lkey_ok(struct ipath_qp *qp, struct ipath_sge *isge,
        int ret;
 
        /*
-        * We use LKEY == zero to mean a physical kmalloc() address.
-        * This is a bit of a hack since we rely on dma_map_single()
-        * being reversible by calling bus_to_virt().
+        * We use LKEY == zero for kernel virtual addresses
+        * (see ipath_get_dma_mr and ipath_dma.c).
         */
        if (sge->lkey == 0) {
+               struct ipath_pd *pd = to_ipd(qp->ibqp.pd);
+
+               if (pd->user) {
+                       ret = 0;
+                       goto bail;
+               }
                isge->mr = NULL;
                isge->vaddr = (void *) sge->addr;
                isge->length = sge->length;
@@ -206,6 +211,12 @@ int ipath_rkey_ok(struct ipath_qp *qp, struct ipath_sge_state *ss,
         * (see ipath_get_dma_mr and ipath_dma.c).
         */
        if (rkey == 0) {
+               struct ipath_pd *pd = to_ipd(qp->ibqp.pd);
+
+               if (pd->user) {
+                       ret = 0;
+                       goto bail;
+               }
                sge->mr = NULL;
                sge->vaddr = (void *) vaddr;
                sge->length = len;