[Slirp] [Git][slirp/libslirp][ndp-leak] ip6_output: fix memory leak on fast-send

Samuel Thibault gitlab at gitlab.freedesktop.org
Thu Feb 18 11:07:00 UTC 2021



Samuel Thibault pushed to branch ndp-leak at slirp / libslirp


Commits:
a973c592 by Samuel Thibault at 2021-02-18T12:06:46+01:00
ip6_output: fix memory leak on fast-send

When emitting NDP Neighbour Sollicitations, ip6_output immediately calls
if_encap without going through any queue. if_encap however does not free
the mbuf, so ip6_output has to do it.

This was leaking one mbuf per NDP NS sent by slirp. Hopefully the guest was
not using more than NDP_TABLE_SIZE (16) IPv6 addresses, in which case it was
limited to a bound number, but more addresses would result to leaks.

- - - - -


1 changed file:

- src/ip6_output.c


Changes:

=====================================
src/ip6_output.c
=====================================
@@ -30,7 +30,10 @@ int ip6_output(struct socket *so, struct mbuf *m, int fast)
     ip->ip_fl_lo = 0;
 
     if (fast) {
+        /* We cannot fast-send non-multicast, we'd need a NDP NS */
+        assert(IN6_IS_ADDR_MULTICAST(&ip->ip_dst));
         if_encap(m->slirp, m);
+        m_free(m);
     } else {
         if_output(so, m);
     }



View it on GitLab: https://gitlab.freedesktop.org/slirp/libslirp/-/commit/a973c5922de7ada4ff4d4b459d4f5b28d2aeb9e0

-- 
View it on GitLab: https://gitlab.freedesktop.org/slirp/libslirp/-/commit/a973c5922de7ada4ff4d4b459d4f5b28d2aeb9e0
You're receiving this email because of your account on gitlab.freedesktop.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/slirp/attachments/20210218/d9a47cff/attachment.htm>


More information about the Slirp mailing list