arcnet: fix potential memory leak in com20020_probe()
authorWang Hai <wanghai38@huawei.com>
Sun, 20 Nov 2022 06:24:38 +0000 (14:24 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 2 Dec 2022 16:40:02 +0000 (17:40 +0100)
commit9cc863d523999de19f609bf8da49d6dad2bba193
treeb628d6ed87d33c1329551548479f9eb0ef69a3ea
parent4d2be0cf27d9b7b508bf9d7b524cfb79e31a6311
arcnet: fix potential memory leak in com20020_probe()

[ Upstream commit 1c40cde6b5171d9c8dfc69be00464fd1c75e210b ]

In com20020_probe(), if com20020_config() fails, dev and info
will not be freed, which will lead to a memory leak.

This patch adds freeing dev and info after com20020_config()
fails to fix this bug.

Compile tested only.

Fixes: 15b99ac17295 ("[PATCH] pcmcia: add return value to _config() functions")
Signed-off-by: Wang Hai <wanghai38@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/arcnet/com20020_cs.c