m68k: emu: Fix invalid free in nfeth_cleanup()
authorPavel Skripkin <paskripkin@gmail.com>
Mon, 5 Jul 2021 20:47:27 +0000 (23:47 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 22 Sep 2021 09:42:59 +0000 (11:42 +0200)
commit617d1f83fb46fdc8237afdf79b97555bf5ac750f
treeebd3482635fb360fccfdf34418a142d3a4383079
parent703884a1dfb7844c3ba9899132bbab73d2e4240c
m68k: emu: Fix invalid free in nfeth_cleanup()

[ Upstream commit 761608f5cf70e8876c2f0e39ca54b516bdcb7c12 ]

In the for loop all nfeth_dev array members should be freed, not only
the first one.  Freeing only the first array member can cause
double-free bugs and memory leaks.

Fixes: 9cd7b148312f ("m68k/atari: ARAnyM - Add support for network access")
Signed-off-by: Pavel Skripkin <paskripkin@gmail.com>
Link: https://lore.kernel.org/r/20210705204727.10743-1-paskripkin@gmail.com
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
arch/m68k/emu/nfeth.c