diff options
author | Thomas Haller <thaller@redhat.com> | 2022-04-26 08:05:23 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2022-04-26 08:05:23 +0200 |
commit | e1a077a913da40f05a1c958e679dc1f927d1da60 (patch) | |
tree | cdd3344cbb479a11735bd1b35ef975cf5f96d11a | |
parent | 3f4f1dda25a7041d22948e09ec42cf5d4c9b2163 (diff) | |
download | libnl-e1a077a913da40f05a1c958e679dc1f927d1da60.tar.gz |
route/link: avoid accessing af_ops after af_free() in rtnl_link_set_family()
-rw-r--r-- | lib/route/link.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/route/link.c b/lib/route/link.c index 65f3dbb7..c1916e72 100644 --- a/lib/route/link.c +++ b/lib/route/link.c @@ -2101,9 +2101,10 @@ void rtnl_link_set_family(struct rtnl_link *link, int family) link->ce_mask |= LINK_ATTR_FAMILY; if (link->l_af_ops) { - af_free(link, link->l_af_ops, - link->l_af_data[link->l_af_ops->ao_family], NULL); - link->l_af_data[link->l_af_ops->ao_family] = NULL; + int ao_family = link->l_af_ops->ao_family; + + af_free(link, link->l_af_ops, link->l_af_data[ao_family], NULL); + link->l_af_data[ao_family] = NULL; } link->l_af_ops = af_lookup_and_alloc(link, family); |