[ovs-dev] [PATCH 1/3] dpif-netdev: Fix memory leak

Gregory Rose gvrose8192 at gmail.com
Fri Nov 17 17:45:58 UTC 2017


On 11/15/2017 6:59 AM, Yifeng Sun wrote:
> Valgrind complains in test 1019 (dpctl - add-if set-if del-if):
>
> 4,850,896 (4,850,240 direct, 656 indirect) bytes in 1 blocks are
> definitely lost in loss record 364 of 364
>     by 0x517062: xcalloc (util.c:103)
>     by 0x46CBBC: dp_netdev_set_nonpmd (dpif-netdev.c:4498)
>     by 0x46CBBC: create_dp_netdev (dpif-netdev.c:1299)
>     by 0x46CBBC: dpif_netdev_open (dpif-netdev.c:1337)
>     by 0x472CB0: do_open (dpif.c:350)
>     by 0x472E6F: dpif_create (dpif.c:404)
>     by 0x472E6F: dpif_create_and_open (dpif.c:417)
>     by 0x430EBC: open_dpif_backer (ofproto-dpif.c:727)
>     by 0x430EBC: construct (ofproto-dpif.c:1411)
>     by 0x41B714: ofproto_create (ofproto.c:539)
>     by 0x40C84E: bridge_reconfigure (bridge.c:647)
>     by 0x4104C5: bridge_run (bridge.c:2998)
>     by 0x406FA4: main (ovs-vswitchd.c:119)
>
> The reference count wasn't released at this earlier return.
>
> This fix passes the test 'make check'.
>
> Signed-off-by: Yifeng Sun <pkusunyifeng at gmail.com>
> ---
>   lib/dpif-netdev.c | 3 +++
>   1 file changed, 3 insertions(+)

Looks good and works as advertised.

Tested-by: Greg Rose <gvrose8192 at gmail.com>
Reviewed-by: Greg Rose <gvrose8192 at gmail.com>
>
> diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
> index db7831874fed..19c81583a892 100644
> --- a/lib/dpif-netdev.c
> +++ b/lib/dpif-netdev.c
> @@ -2925,6 +2925,9 @@ dpif_netdev_execute(struct dpif *dpif, struct dpif_execute *execute)
>           /* If this is part of a probe, Drop the packet, since executing
>            * the action may actually cause spurious packets be sent into
>            * the network. */
> +        if (pmd->core_id == NON_PMD_CORE_ID) {
> +            dp_netdev_pmd_unref(pmd);
> +        }
>           return 0;
>       }
>   



More information about the dev mailing list