]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
RDMA/uverbs: Verify MR access flags
authorMichael Guralnik <michaelgur@mellanox.com>
Wed, 8 Jan 2020 18:05:35 +0000 (20:05 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 14 Feb 2020 21:52:56 +0000 (16:52 -0500)
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: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
include/rdma/ib_verbs.h

index 5608e14e3aadf893570e4189c81cb5472a27e184..8d0f447e1faa12960828f3aae96d7a5926bd8a57 100644 (file)
@@ -4300,6 +4300,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;
 }