# HG changeset patch
# User Robert Walsh <[EMAIL PROTECTED]>
# Date 1173994465 25200
# Node ID bf280d5f83d59788b58c17ff206bc3f54271a790
# Parent  8c4f730dbde3eed6e066ead5be4746d58840f24f
IB/ipath - check reserved keys

Don't let userspace use the direct-physical-map L-key or R-key.

Signed-off-by: Ralph Campbell <[EMAIL PROTECTED]>

diff -r 8c4f730dbde3 -r bf280d5f83d5 drivers/infiniband/hw/ipath/ipath_keys.c
--- a/drivers/infiniband/hw/ipath/ipath_keys.c  Thu Mar 15 14:34:25 2007 -0700
+++ b/drivers/infiniband/hw/ipath/ipath_keys.c  Thu Mar 15 14:34:25 2007 -0700
@@ -133,6 +133,12 @@ int ipath_lkey_ok(struct ipath_qp *qp, s
         * being reversible by calling bus_to_virt().
         */
        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 +212,12 @@ int ipath_rkey_ok(struct ipath_qp *qp, s
         * (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;
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to