IB/uverbs: Fix command checking as part of ib_uverbs_ex_modify_qp()
authorMoni Shoua <[email protected]>
Sun, 24 Dec 2017 11:54:57 +0000 (13:54 +0200)
committerJason Gunthorpe <[email protected]>
Wed, 27 Dec 2017 22:24:41 +0000 (15:24 -0700)
If the input command length is larger than the kernel supports an error should
be returned in case the unsupported bytes are not cleared, instead of the
other way aroudn. This matches what all other callers of ib_is_udata_cleared
do and will avoid user ABI problems in the future.

Cc: <[email protected]> # v4.10
Fixes: 189aba99e700 ("IB/uverbs: Extend modify_qp and support packet pacing")
Reviewed-by: Yishai Hadas <[email protected]>
Signed-off-by: Moni Shoua <[email protected]>
Signed-off-by: Leon Romanovsky <[email protected]>
Signed-off-by: Jason Gunthorpe <[email protected]>
drivers/infiniband/core/uverbs_cmd.c

index d0202bb176a4a6a826b27f2b4327691e334ad4ea..840b24096690ddcdef6ce894c5ee21b6285bf238 100644 (file)
@@ -2074,8 +2074,8 @@ int ib_uverbs_ex_modify_qp(struct ib_uverbs_file *file,
                return -EOPNOTSUPP;
 
        if (ucore->inlen > sizeof(cmd)) {
-               if (ib_is_udata_cleared(ucore, sizeof(cmd),
-                                       ucore->inlen - sizeof(cmd)))
+               if (!ib_is_udata_cleared(ucore, sizeof(cmd),
+                                        ucore->inlen - sizeof(cmd)))
                        return -EOPNOTSUPP;
        }