cxl: fix return value in cxlctl_validate_set_features()
authorDan Carpenter <dan.carpenter@linaro.org>
Wed, 28 May 2025 08:11:41 +0000 (11:11 +0300)
committerDave Jiang <dave.jiang@intel.com>
Mon, 9 Jun 2025 16:18:15 +0000 (09:18 -0700)
The cxlctl_validate_set_features() function is type bool.  It's supposed
to return true for valid requests and false for invalid.  However, this
error path returns ERR_PTR(-EINVAL) which is true when it was intended to
return false.

The incorrect return will result in kernel failing to prevent a
incorrect op_size passed in from userspace to be detected.

[ dj: Add user impact to commit log ]

Fixes: f76e0bbc8bc3 ("cxl: Update prototype of function get_support_feature_info()")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Reviewed-by: Ira Weiny <ira.weiny@intel.com>
Link: https://patch.msgid.link/aDbFPSCujpJLY1if@stanley.mountain
Signed-off-by: Dave Jiang <dave.jiang@intel.com>
drivers/cxl/core/features.c

index 6f2eae1eb126ca0d740d3a598d49295ad526b6b8..7c750599ea6906e1c3f77bf53dbc699072984655 100644 (file)
@@ -544,7 +544,7 @@ static bool cxlctl_validate_set_features(struct cxl_features_state *cxlfs,
        u32 flags;
 
        if (rpc_in->op_size < sizeof(uuid_t))
-               return ERR_PTR(-EINVAL);
+               return false;
 
        feat = cxl_feature_info(cxlfs, &rpc_in->set_feat_in.uuid);
        if (IS_ERR(feat))