Skip to contentSkip to conversation

common/cnxk: fix missing null check for inline device

PATCH Applied Volodymyr Fialko 2 participants 2 messages Mar 28, 2022 – May 2, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 common/cnxk: fix missing null check for inline device

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")
---
 drivers/common/cnxk/roc_nix_inl.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/common/cnxk/roc_nix_inl.c +2 -0
index 877a9f1aa8..d0a38d2d4d 100644
@@ -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;
Signature · 1 line
2.25.1
Acked-by on v1 1/1 Applied
#1 lore raw
Quoted 9 lines · Volodymyr Fialko

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")

Applied to dpdk-next-net-mrvl/for-next-net. Thanks

Quoted 20 lines
---
 drivers/common/cnxk/roc_nix_inl.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/common/cnxk/roc_nix_inl.c +2 -1
index 877a9f1aa8..d0a38d2d4d 100644
@@ -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