netdev-dummy: Avoid double-free in netdev_dummy_ip4addr().
netdev_dummy_ip6addr() calls netdev_close() twice though it increases
netdev's reference only once from netdev_from_name(). As a result, Valgrind
test 788 (tunnel_push_pop - action) reports the error below:
==20465== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
Invalid read of size 8
at 0x493FE0: netdev_get_name (netdev.c:911)
by 0x5125D3: tnl_port_map_delete_ipdev (tnl-ports.c:470)
by 0x4E551C: __rt_entry_delete (ovs-router.c:252)
by 0x4E64AA: ovs_router_flush (ovs-router.c:478)
by 0x475CA8: call_hooks.part.2 (fatal-signal.c:254)
by 0x5E53FF7: __run_exit_handlers (exit.c:82)
by 0x5E54044: exit (exit.c:104)
by 0x5E3A836: (below main) (libc-start.c:325)
Address 0x65ea680 is 0 bytes inside a block of size 640 free'd
at 0x4C2EDEB: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
by 0x492BA2: netdev_unref (netdev.c:572)
by 0x41646E: ofport_destroy__ (ofproto.c:2516)
by 0x41FD58: ofproto_destroy (ofproto.c:1645)
by 0x40B96B: bridge_destroy (bridge.c:3273)
by 0x410238: bridge_exit (bridge.c:506)
by 0x40700E: main (ovs-vswitchd.c:135)
Block was alloc'd at
at 0x4C2FB55: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
by 0x516A82: xcalloc (util.c:103)
by 0x48D74D: netdev_dummy_alloc (netdev-dummy.c:661)
by 0x4931D1: netdev_open.part.12 (netdev.c:406)
by 0x40A985: iface_do_create (bridge.c:1784)
by 0x40A985: iface_create (bridge.c:1837)
by 0x40A985: bridge_add_ports__ (bridge.c:931)
by 0x40C7EA: bridge_add_ports (bridge.c:947)
by 0x40C7EA: bridge_reconfigure (bridge.c:663)
by 0x410485: bridge_run (bridge.c:2998)
by 0x406F64: main (ovs-vswitchd.c:119)
Signed-off-by: Yifeng Sun <pkusunyifeng@gmail.com> Signed-off-by: Ben Pfaff <blp@ovn.org>