Message ID | 20200618132629.659977-1-zhengbin13@huawei.com |
---|---|
State | New |
Headers | show |
Series | [-next] macvlan: Fix memleak in macvlan_changelink_sources | expand |
diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c index 6a6cc9f75307..0017c5d28a27 100644 --- a/drivers/net/macvlan.c +++ b/drivers/net/macvlan.c @@ -1379,8 +1379,10 @@ static int macvlan_changelink_sources(struct macvlan_dev *vlan, u32 mode, addr = nla_data(nla); ret = macvlan_hash_add_source(vlan, addr); - if (ret) + if (ret) { + macvlan_flush_sources(vlan->port, vlan); return ret; + } } } else { return -EINVAL;
macvlan_changelink_sources if (addr) ret = macvlan_hash_add_source(vlan, addr) nla_for_each_attr(nla, head, len, rem) ret = macvlan_hash_add_source(vlan, addr) -->If fail, need to free previous malloc memory Fixes: 79cf79abce71 ("macvlan: add source mode") Signed-off-by: Zheng Bin <zhengbin13@huawei.com> --- drivers/net/macvlan.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) -- 2.25.4