event/dlb2: fix QID inflight exploit

Message ID 20220606160311.1227058-1-timothy.mcdaniel@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Jerin Jacob
Headers
Series event/dlb2: fix QID inflight exploit |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation fail Compilation issues
ci/intel-Testing success Testing PASS
ci/github-robot: build success github build: passed
ci/iol-aarch64-compile-testing success Testing PASS
ci/iol-aarch64-unit-testing success Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/iol-abi-testing success Testing PASS

Commit Message

Timothy McDaniel June 6, 2022, 4:03 p.m. UTC
  If QID inflights is set to an invalid value it can cause the
PMD to hang.  This commit adds checks to make sure that the
value is valid before programming the hardware.

Fixes: 1857f1922ce2 ("event/dlb2: use new implementation of resource file")
Cc: stable@dpdk.org

Signed-off-by: Timothy McDaniel <timothy.mcdaniel@intel.com>
---
 drivers/event/dlb2/pf/base/dlb2_resource.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Jerin Jacob June 9, 2022, 5:58 p.m. UTC | #1
On Mon, Jun 6, 2022 at 9:33 PM Timothy McDaniel
<timothy.mcdaniel@intel.com> wrote:
>
> If QID inflights is set to an invalid value it can cause the
> PMD to hang.  This commit adds checks to make sure that the
> value is valid before programming the hardware.
>
> Fixes: 1857f1922ce2 ("event/dlb2: use new implementation of resource file")
> Cc: stable@dpdk.org
>
> Signed-off-by: Timothy McDaniel <timothy.mcdaniel@intel.com>

Applied to dpdk-next-net-eventdev/for-main. Thanks


> ---
>  drivers/event/dlb2/pf/base/dlb2_resource.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/event/dlb2/pf/base/dlb2_resource.c b/drivers/event/dlb2/pf/base/dlb2_resource.c
> index d4c49c2992..548bebd068 100644
> --- a/drivers/event/dlb2/pf/base/dlb2_resource.c
> +++ b/drivers/event/dlb2/pf/base/dlb2_resource.c
> @@ -3701,7 +3701,7 @@ dlb2_verify_create_ldb_queue_args(struct dlb2_hw *hw,
>                 }
>         }
>
> -       if (args->num_qid_inflights > 4096) {
> +       if (args->num_qid_inflights < 1 || args->num_qid_inflights > 2048) {
>                 resp->status = DLB2_ST_INVALID_QID_INFLIGHT_ALLOCATION;
>                 return -EINVAL;
>         }
> --
> 2.25.1
>
  

Patch

diff --git a/drivers/event/dlb2/pf/base/dlb2_resource.c b/drivers/event/dlb2/pf/base/dlb2_resource.c
index d4c49c2992..548bebd068 100644
--- a/drivers/event/dlb2/pf/base/dlb2_resource.c
+++ b/drivers/event/dlb2/pf/base/dlb2_resource.c
@@ -3701,7 +3701,7 @@  dlb2_verify_create_ldb_queue_args(struct dlb2_hw *hw,
 		}
 	}
 
-	if (args->num_qid_inflights > 4096) {
+	if (args->num_qid_inflights < 1 || args->num_qid_inflights > 2048) {
 		resp->status = DLB2_ST_INVALID_QID_INFLIGHT_ALLOCATION;
 		return -EINVAL;
 	}