Messages in this thread Patch in this message | | | From | Zheng Bin <> | Subject | [PATCH -next] macvlan: Fix memleak in macvlan_changelink_sources | Date | Thu, 18 Jun 2020 21:26:29 +0800 |
| |
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(-)
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; -- 2.25.4
| |