]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
RDMA/nes: Fix for crash when registering zero length MR for CQ
authorTatyana Nikolova <Tatyana.E.Nikolova@intel.com>
Thu, 6 Dec 2012 20:05:02 +0000 (20:05 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 17 Jan 2013 16:46:11 +0000 (08:46 -0800)
commit 7d9c199a55200c9b9fcad08e150470d02fb385be upstream.

Signed-off-by: Tatyana Nikolova <Tatyana.E.Nikolova@intel.com>
Signed-off-by: Roland Dreier <roland@purestorage.com>
Signed-off-by: CAI Qian <caiqian@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/infiniband/hw/nes/nes_verbs.c

index cd0ecb215cca01c5be942da3bf4c07bcc3895c5f..928ca350b17bf6e8d6549e14561e736227e24a42 100644 (file)
@@ -2559,6 +2559,11 @@ static struct ib_mr *nes_reg_user_mr(struct ib_pd *pd, u64 start, u64 length,
                        return ibmr;
                case IWNES_MEMREG_TYPE_QP:
                case IWNES_MEMREG_TYPE_CQ:
+                       if (!region->length) {
+                               nes_debug(NES_DBG_MR, "Unable to register zero length region for CQ\n");
+                               ib_umem_release(region);
+                               return ERR_PTR(-EINVAL);
+                       }
                        nespbl = kzalloc(sizeof(*nespbl), GFP_KERNEL);
                        if (!nespbl) {
                                nes_debug(NES_DBG_MR, "Unable to allocate PBL\n");