aboutsummaryrefslogtreecommitdiffstats
path: root/net/hsr/hsr_slave.c
diff options
context:
space:
mode:
authorCong Wang <xiyou.wangcong@gmail.com>2019-07-03 17:21:12 -0700
committerDavid S. Miller <davem@davemloft.net>2019-07-05 15:22:27 -0700
commit619afef01f74f3572b5e9a266c1230dc83761eec (patch)
tree655b4815bf5014dda535cdc8b4c4527ebf48909a /net/hsr/hsr_slave.c
parentMerge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/klassert/ipsec (diff)
downloadlinux-dev-619afef01f74f3572b5e9a266c1230dc83761eec.tar.xz
linux-dev-619afef01f74f3572b5e9a266c1230dc83761eec.zip
hsr: fix a memory leak in hsr_del_port()
hsr_del_port() should release all the resources allocated in hsr_add_port(). As a consequence of this change, hsr_for_each_port() is no longer safe to work with hsr_del_port(), switch to list_for_each_entry_safe() as we always hold RTNL lock. Cc: Arvid Brodin <arvid.brodin@alten.se> Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/hsr/hsr_slave.c')
-rw-r--r--net/hsr/hsr_slave.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/net/hsr/hsr_slave.c b/net/hsr/hsr_slave.c
index 88b6705ded83..ee561297d8a7 100644
--- a/net/hsr/hsr_slave.c
+++ b/net/hsr/hsr_slave.c
@@ -193,4 +193,5 @@ void hsr_del_port(struct hsr_port *port)
if (port != master)
dev_put(port->dev);
+ kfree(port);
}