1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-22 11:17:19 +00:00

Plug an ifaddr leak when changing a route's src

If a route is modified in a way that changes the route's source
address (i.e. the address used to access the gateway), then a
reference on the ifaddr representing the old source address will
be leaked if the address type does not have an ifa_rtrequest
method defined.  Plug the leak by releasing the reference in
all cases.

Differential Revision:	https://reviews.freebsd.org/D13417
Reviewed by:	ae
MFC after:	3 weeks
Sponsored by:	Dell
This commit is contained in:
Ryan Stone 2017-12-14 20:48:50 +00:00
parent 9ee02cd6f8
commit 19f41c2a52
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=326860

View File

@ -1781,8 +1781,9 @@ rtrequest1_fib_change(struct rib_head *rnh, struct rt_addrinfo *info,
/* Check if outgoing interface has changed */
if (info->rti_ifa != NULL && info->rti_ifa != rt->rt_ifa &&
rt->rt_ifa != NULL && rt->rt_ifa->ifa_rtrequest != NULL) {
rt->rt_ifa->ifa_rtrequest(RTM_DELETE, rt, info);
rt->rt_ifa != NULL) {
if (rt->rt_ifa->ifa_rtrequest != NULL)
rt->rt_ifa->ifa_rtrequest(RTM_DELETE, rt, info);
ifa_free(rt->rt_ifa);
}
/* Update gateway address */