From: Jay Ding <[email protected]>
rte_eth_dev_info_get() could fail due to device reset, etc.
The return value should be checked before the device info
pointer is dereferenced.
Fixes: 2f196c80e716 ("netdev-dpdk: Use LSC interrupt mode.")
Signed-off-by: Jay Ding <[email protected]>
---
Sending for Jay for visibility on mailing list, I will send comments next [kt]
---
lib/netdev-dpdk.c | 31 +++++++++++++++++--------------
1 file changed, 17 insertions(+), 14 deletions(-)
diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
index 549887b31..9d9feb88a 100644
--- a/lib/netdev-dpdk.c
+++ b/lib/netdev-dpdk.c
@@ -2423,19 +2423,22 @@ netdev_dpdk_set_config(struct netdev *netdev, const
struct smap *args,
}
- lsc_interrupt_mode = smap_get_bool(args, "dpdk-lsc-interrupt", true);
- if (lsc_interrupt_mode && !(*info.dev_flags & RTE_ETH_DEV_INTR_LSC)) {
- if (smap_get(args, "dpdk-lsc-interrupt")) {
- VLOG_WARN_BUF(errp, "'%s': link status interrupt is not "
- "supported.", netdev_get_name(netdev));
- err = EINVAL;
- goto out;
+ if (!ret) {
+ lsc_interrupt_mode = smap_get_bool(args, "dpdk-lsc-interrupt", true);
+ if (lsc_interrupt_mode && !(*info.dev_flags & RTE_ETH_DEV_INTR_LSC)) {
+ if (smap_get(args, "dpdk-lsc-interrupt")) {
+ VLOG_WARN_BUF(errp, "'%s': link status interrupt is not "
+ "supported.", netdev_get_name(netdev));
+ err = EINVAL;
+ goto out;
+ }
+ VLOG_DBG("'%s': not enabling link status interrupt.",
+ netdev_get_name(netdev));
+ lsc_interrupt_mode = false;
+ }
+
+ if (dev->requested_lsc_interrupt_mode != lsc_interrupt_mode) {
+ dev->requested_lsc_interrupt_mode = lsc_interrupt_mode;
+ netdev_request_reconfigure(netdev);
}
- VLOG_DBG("'%s': not enabling link status interrupt.",
- netdev_get_name(netdev));
- lsc_interrupt_mode = false;
- }
- if (dev->requested_lsc_interrupt_mode != lsc_interrupt_mode) {
- dev->requested_lsc_interrupt_mode = lsc_interrupt_mode;
- netdev_request_reconfigure(netdev);
}
--
2.49.0
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev