diff mbox

[RFC,v2,12/12] IB/core: add a protection to ib_get_dma_mr

Message ID 1474367764-9555-13-git-send-email-Ram.Amrani@cavium.com (mailing list archive)
State RFC
Headers show

Commit Message

Amrani, Ram Sept. 20, 2016, 10:36 a.m. UTC
From: Ram amrani <Ram.Amrani@cavium.com>

Add a check that prevents ib_get_dma_mr from executing if
IB_ACCESS_MW_BIND is set.

Signed-off-by: Ram Amrani <Ram.Amrani@cavium.com>
---
 drivers/infiniband/core/verbs.c | 3 +++
 1 file changed, 3 insertions(+)
diff mbox

Patch

diff --git a/drivers/infiniband/core/verbs.c b/drivers/infiniband/core/verbs.c
index f2b776e..8cc6f79 100644
--- a/drivers/infiniband/core/verbs.c
+++ b/drivers/infiniband/core/verbs.c
@@ -1400,6 +1400,9 @@  struct ib_mr *ib_get_dma_mr(struct ib_pd *pd, int mr_access_flags)
 	if (err)
 		return ERR_PTR(err);
 
+	if (mr_access_flags & IB_ACCESS_MW_BIND)
+		return ERR_PTR(-EINVAL);
+
 	mr = pd->device->get_dma_mr(pd, mr_access_flags);
 
 	if (!IS_ERR(mr)) {