net/failsafe: Fix crash due to in-valid sub-device port id

Message ID 20221116095224.1576-1-madhuker.mythri@oracle.com (mailing list archive)
State Superseded, archived
Delegated to: Andrew Rybchenko
Headers
Series net/failsafe: Fix crash due to in-valid sub-device port id |

Checks

Context Check Description
ci/checkpatch warning coding style issues
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/Intel-compilation success Compilation OK
ci/iol-intel-Functional success Functional Testing PASS
ci/intel-Testing success Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/github-robot: build success github build: passed
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-aarch64-compile-testing success Testing PASS

Commit Message

Madhuker Mythri Nov. 16, 2022, 9:52 a.m. UTC
  From: Madhuker Mythri <madhuker.mythri@oracle.com>

Crash occuring while the DPDK secondary processes trying to probe the tap-device, where tap-device is a sub-device of Fail-safe device.
Some-times we get in-valid sub-devices(with the in-valid port-id’s and device-names), due to which the IPC communication does not get response and causes the communication failures b/w primary/secondary process.
So, need to validate the sub-device(tap) while secondary process probe in the Fail-safe PMD, to avoid such issues.
Bugzilla Id: 1116

Signed-off-by: Madhuker Mythri <madhuker.mythri@oracle.com>
---
 drivers/net/failsafe/failsafe.c | 4 ++++
 1 file changed, 4 insertions(+)
  

Comments

Stephen Hemminger Nov. 16, 2022, 5:51 p.m. UTC | #1
On Wed, 16 Nov 2022 15:22:24 +0530
madhuker.mythri@oracle.com wrote:

>  
> +			if (!rte_eth_dev_is_valid_port(PORT_ID(sdev))) {
> +				continue;
> +			}
> +

Looks ok but DPDK follows kernel style {} is unnecessary on single statement.
Checkpatch will give you warnings on this.
  

Patch

diff --git a/drivers/net/failsafe/failsafe.c b/drivers/net/failsafe/failsafe.c
index 32811403b4..3663976697 100644
--- a/drivers/net/failsafe/failsafe.c
+++ b/drivers/net/failsafe/failsafe.c
@@ -361,6 +361,10 @@  rte_pmd_failsafe_probe(struct rte_vdev_device *vdev)
 			if (sdev->devargs.name[0] == '\0')
 				continue;
 
+			if (!rte_eth_dev_is_valid_port(PORT_ID(sdev))) {
+				continue;
+			}
+
 			/* rebuild devargs to be able to get the bus name. */
 			ret = rte_devargs_parse(&devargs,
 						sdev->devargs.name);