| From 4ec2c4d9a53ae70dde429bb050440fbb10848279 Mon Sep 17 00:00:00 2001 |
| From: Michael Guralnik <michaelgur@mellanox.com> |
| Date: Wed, 8 Jan 2020 20:05:35 +0200 |
| Subject: [PATCH] RDMA/uverbs: Verify MR access flags |
| |
| commit ca95c1411198c2d87217c19d44571052cdc94725 upstream. |
| |
| Verify that MR access flags that are passed from user are all supported |
| ones, otherwise an error is returned. |
| |
| Fixes: 4fca03778351 ("IB/uverbs: Move ib_access_flags and ib_read_counters_flags to uapi") |
| Link: https://lore.kernel.org/r/1578506740-22188-6-git-send-email-yishaih@mellanox.com |
| Signed-off-by: Michael Guralnik <michaelgur@mellanox.com> |
| Signed-off-by: Yishai Hadas <yishaih@mellanox.com> |
| Signed-off-by: Jason Gunthorpe <jgg@mellanox.com> |
| Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com> |
| |
| diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h |
| index d655e10791aa..07390b56dcc4 100644 |
| --- a/include/rdma/ib_verbs.h |
| +++ b/include/rdma/ib_verbs.h |
| @@ -4259,6 +4259,9 @@ static inline int ib_check_mr_access(int flags) |
| !(flags & IB_ACCESS_LOCAL_WRITE)) |
| return -EINVAL; |
| |
| + if (flags & ~IB_ACCESS_SUPPORTED) |
| + return -EINVAL; |
| + |
| return 0; |
| } |
| |
| -- |
| 2.7.4 |
| |