ethdev: rte_eth_dev_callback_unregister() fails with cb_arg == -1

Message ID 20200107155136.70237-1-rroldan@bequant.com (mailing list archive)
State Accepted, archived
Delegated to: Ferruh Yigit
Headers
Series ethdev: rte_eth_dev_callback_unregister() fails with cb_arg == -1 |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-testing success Testing PASS
ci/iol-nxp-Performance success Performance Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/travis-robot success Travis build: passed
ci/Intel-compilation success Compilation OK

Commit Message

Ricardo Roldan Jan. 7, 2020, 3:51 p.m. UTC
  The function was checking -1 against the callback data instead of
the given cb_arg parameter.

Signed-off-by: Ricardo Roldan <rroldan@bequant.com>
---
 lib/librte_ethdev/rte_ethdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Ferruh Yigit Jan. 13, 2020, 4:45 p.m. UTC | #1
On 1/7/2020 3:51 PM, Ricardo Roldan wrote:
> The function was checking -1 against the callback data instead of
> the given cb_arg parameter.
> 
> Signed-off-by: Ricardo Roldan <rroldan@bequant.com>

Updated title as:
    ethdev: fix callback unregister with wildcard argument list

Also adding following metadata to the commit log:
    Fixes: af75078fece3 ("first public release")
    Cc: stable@dpdk.org


Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
Applied to dpdk-next-net/master, thanks.

(This bug seems as old as DPDK itself J, thanks for fixing it.)
  

Patch

diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c
index 6e9cb243e..aec2d0f70 100644
--- a/lib/librte_ethdev/rte_ethdev.c
+++ b/lib/librte_ethdev/rte_ethdev.c
@@ -4039,7 +4039,7 @@  rte_eth_dev_callback_unregister(uint16_t port_id,
 			next = TAILQ_NEXT(cb, next);
 
 			if (cb->cb_fn != cb_fn || cb->event != event ||
-			    (cb->cb_arg != (void *)-1 && cb->cb_arg != cb_arg))
+			    (cb_arg != (void *)-1 && cb->cb_arg != cb_arg))
 				continue;
 
 			/*