hsr: fix a memory leak in hsr_del_port()
authorCong Wang <xiyou.wangcong@gmail.com>
Thu, 4 Jul 2019 00:21:12 +0000 (17:21 -0700)
committerDavid S. Miller <davem@davemloft.net>
Fri, 5 Jul 2019 22:22:27 +0000 (15:22 -0700)
commit619afef01f74f3572b5e9a266c1230dc83761eec
tree655b4815bf5014dda535cdc8b4c4527ebf48909a
parent114b5b355ec0b6e83a6628a5ab5d03e50fd40a31
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>
net/hsr/hsr_device.c
net/hsr/hsr_slave.c