event/sw: fix missing device pointer

Message ID 20231016151713.711965-1-bruce.richardson@intel.com (mailing list archive)
State Superseded, archived
Delegated to: Jerin Jacob
Headers
Series event/sw: fix missing device pointer |

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/github-robot: build success github build: passed
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-unit-arm64-testing success Testing PASS
ci/iol-compile-amd64-testing success Testing PASS
ci/iol-unit-amd64-testing success Testing PASS
ci/iol-compile-arm64-testing success Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS

Commit Message

Bruce Richardson Oct. 16, 2023, 3:17 p.m. UTC
  After calling rte_event_dev_info_get() the ".dev" field of the info
structure should have a pointer to the underlying device, allowing the
user to e.g. get the device name using using rte_dev_name(info.dev).

The SW eventdev info structure did not return a correct device pointer,
though, instead returning NULL, which caused crashes getting
"rte_dev_name". Initializing the dev pointer inside the "eventdev"
struct in the device probe function fixes this by ensuring we have a
valid pointer to return in info_get calls.

Fixes: aaa4a221da26 ("event/sw: add new software-only eventdev driver")
Cc: stable@dpdk.org

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
 drivers/event/sw/sw_evdev.c | 1 +
 1 file changed, 1 insertion(+)
  

Comments

Van Haaren, Harry Oct. 17, 2023, 12:45 p.m. UTC | #1
> -----Original Message-----
> From: Richardson, Bruce <bruce.richardson@intel.com>
> Sent: Monday, October 16, 2023 4:17 PM
> To: dev@dpdk.org
> Cc: Richardson, Bruce <bruce.richardson@intel.com>; stable@dpdk.org; Van
> Haaren, Harry <harry.van.haaren@intel.com>; Jerin Jacob
> <jerin.jacob@caviumnetworks.com>
> Subject: [PATCH] event/sw: fix missing device pointer
> 
> After calling rte_event_dev_info_get() the ".dev" field of the info
> structure should have a pointer to the underlying device, allowing the
> user to e.g. get the device name using using rte_dev_name(info.dev).
> 
> The SW eventdev info structure did not return a correct device pointer,
> though, instead returning NULL, which caused crashes getting
> "rte_dev_name". Initializing the dev pointer inside the "eventdev"
> struct in the device probe function fixes this by ensuring we have a
> valid pointer to return in info_get calls.
> 
> Fixes: aaa4a221da26 ("event/sw: add new software-only eventdev driver")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>

Acked-by: Harry van Haaren <harry.van.haaren@intel.com>
  

Patch

diff --git a/drivers/event/sw/sw_evdev.c b/drivers/event/sw/sw_evdev.c
index 6d1816b76d..bf166a8cfc 100644
--- a/drivers/event/sw/sw_evdev.c
+++ b/drivers/event/sw/sw_evdev.c
@@ -1080,6 +1080,7 @@  sw_probe(struct rte_vdev_device *vdev)
 		SW_LOG_ERR("eventdev vdev init() failed");
 		return -EFAULT;
 	}
+	dev->dev = &vdev->device;
 	dev->dev_ops = &evdev_sw_ops;
 	dev->enqueue = sw_event_enqueue;
 	dev->enqueue_burst = sw_event_enqueue_burst;