[dpdk-dev] [PATCH] rte_ethdev: fix unsafe memory access by calling RX callback.
tgw_team(腾讯网关团队)
tgw_team at tencent.com
Wed Mar 4 17:26:14 CET 2020
As a newcomer, I'm sorry for my mistakes. I will try to do better in the future.
>On 3/4/20 5:05 PM, Tencent TGW team wrote:
>> When compiling with -O0,
>> the compiler does not optimize two memory accesses into one.
>> Leads to accessing a null pointer when calling the RX callback.
>> The way to access the TX callback is correct.
>
>It looks like the patch is not passed through check-git-log.sh.
>RX -> Rx, TX -> Tx
Sorry, I will check and refine in patch v2.
>>
>>
>> Signed-off-by: Tencent TGW team <tgw_team at tencent.com>
>If I'm not mistaken, it must be a person here, not team.
Is there any way to submit patches as a team?
>> ---
>> lib/librte_ethdev/rte_ethdev.h | 6 ++----
>> 1 file changed, 2 insertions(+), 4 deletions(-)
>>
>> diff --git a/lib/librte_ethdev/rte_ethdev.h b/lib/librte_ethdev/rte_ethdev.h
>> index d1a593ad1..35eb580ff 100644
>> --- a/lib/librte_ethdev/rte_ethdev.h
>> +++ b/lib/librte_ethdev/rte_ethdev.h
>> @@ -4388,10 +4388,8 @@ rte_eth_rx_burst(uint16_t port_id, uint16_t queue_id,
>> rx_pkts, nb_pkts);
>>
>> #ifdef RTE_ETHDEV_RXTX_CALLBACKS
>> - if (unlikely(dev->post_rx_burst_cbs[queue_id] != NULL)) {
>> - struct rte_eth_rxtx_callback *cb =
>> - dev->post_rx_burst_cbs[queue_id];
>> -
>> + struct rte_eth_rxtx_callback *cb = dev->post_rx_burst_cbs[queue_id];
>> + if (unlikely(cb != NULL)) {
>> do {
>> nb_rx = cb->fn.rx(port_id, queue_id, rx_pkts, nb_rx,
>> nb_pkts, cb->param);
>>
>Sorry, but I don't understand. I don't see the difference in
>potential NULL pointer deference above. What is the compiler? Version?
gcc version 7.4.0
I think this problem has nothing to do with the compiler version.
>Or is it a race condition with queue post Rx burst callback
>removal while traffic is running?
You're right.
More information about the dev
mailing list