common/cnxk: fix missing null check for inline device
Checks
Commit Message
Inline device could be null in cases when it was not bound or missing.
Added check to prevent null pointer access.
Fixes: fe5846bcc07 ("net/cnxk: add devargs for min-max SPI")
Cc: stable@dpdk.org
Signed-off-by: Volodymyr Fialko <vfialko@marvell.com>
---
drivers/common/cnxk/roc_nix_inl.c | 2 ++
1 file changed, 2 insertions(+)
Comments
On Mon, Mar 28, 2022 at 4:11 PM Volodymyr Fialko <vfialko@marvell.com> wrote:
>
> Inline device could be null in cases when it was not bound or missing.
> Added check to prevent null pointer access.
>
> Fixes: fe5846bcc07 ("net/cnxk: add devargs for min-max SPI")
>
> Cc: stable@dpdk.org
>
> Signed-off-by: Volodymyr Fialko <vfialko@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
Applied to dpdk-next-net-mrvl/for-next-net. Thanks
> ---
> drivers/common/cnxk/roc_nix_inl.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/common/cnxk/roc_nix_inl.c b/drivers/common/cnxk/roc_nix_inl.c
> index 877a9f1aa8..d0a38d2d4d 100644
> --- a/drivers/common/cnxk/roc_nix_inl.c
> +++ b/drivers/common/cnxk/roc_nix_inl.c
> @@ -158,6 +158,8 @@ roc_nix_inl_inb_spi_range(struct roc_nix *roc_nix, bool inb_inl_dev,
>
> inl_dev = idev->nix_inl_dev;
> if (inb_inl_dev) {
> + if (inl_dev == NULL)
> + goto exit;
> min = inl_dev->ipsec_in_min_spi;
> max = inl_dev->ipsec_in_max_spi;
> mask = inl_dev->inb_spi_mask;
> --
> 2.25.1
>
@@ -158,6 +158,8 @@ roc_nix_inl_inb_spi_range(struct roc_nix *roc_nix, bool inb_inl_dev,
inl_dev = idev->nix_inl_dev;
if (inb_inl_dev) {
+ if (inl_dev == NULL)
+ goto exit;
min = inl_dev->ipsec_in_min_spi;
max = inl_dev->ipsec_in_max_spi;
mask = inl_dev->inb_spi_mask;