Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=fb74dacb0f00dff851c78411773a5bd5d7128b81
Commit:     fb74dacb0f00dff851c78411773a5bd5d7128b81
Parent:     2ffbb8377c7a0713baf6644e285adc27a5654582
Author:     Ralph Campbell <[EMAIL PROTECTED]>
AuthorDate: Tue Nov 6 17:51:38 2007 -0800
Committer:  Roland Dreier <[EMAIL PROTECTED]>
CommitDate: Tue Nov 20 11:03:26 2007 -0800

    IB/ipath: Fix offset returned to ibv_resize_cq()
    
    The wrong offset was being returned to libipathverbs so that when
    ibv_resize_cq() calls mmap(), it always fails.
    
    Signed-off-by: Ralph Campbell <[EMAIL PROTECTED]>
    Signed-off-by: Roland Dreier <[EMAIL PROTECTED]>
---
 drivers/infiniband/hw/ipath/ipath_cq.c |   19 ++++++++++++++-----
 1 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/drivers/infiniband/hw/ipath/ipath_cq.c 
b/drivers/infiniband/hw/ipath/ipath_cq.c
index 08d8ae1..d1380c7 100644
--- a/drivers/infiniband/hw/ipath/ipath_cq.c
+++ b/drivers/infiniband/hw/ipath/ipath_cq.c
@@ -395,12 +395,9 @@ int ipath_resize_cq(struct ib_cq *ibcq, int cqe, struct 
ib_udata *udata)
                goto bail;
        }
 
-       /*
-        * Return the address of the WC as the offset to mmap.
-        * See ipath_mmap() for details.
-        */
+       /* Check that we can write the offset to mmap. */
        if (udata && udata->outlen >= sizeof(__u64)) {
-               __u64 offset = (__u64) wc;
+               __u64 offset = 0;
 
                ret = ib_copy_to_udata(udata, &offset, sizeof(offset));
                if (ret)
@@ -450,6 +447,18 @@ int ipath_resize_cq(struct ib_cq *ibcq, int cqe, struct 
ib_udata *udata)
                struct ipath_mmap_info *ip = cq->ip;
 
                ipath_update_mmap_info(dev, ip, sz, wc);
+
+               /*
+                * Return the offset to mmap.
+                * See ipath_mmap() for details.
+                */
+               if (udata && udata->outlen >= sizeof(__u64)) {
+                       ret = ib_copy_to_udata(udata, &ip->offset,
+                                              sizeof(ip->offset));
+                       if (ret)
+                               goto bail;
+               }
+
                spin_lock_irq(&dev->pending_lock);
                if (list_empty(&ip->pending_mmaps))
                        list_add(&ip->pending_mmaps, &dev->pending_mmaps);
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to