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:41:07 +0000 (17:41 +0100)
commit88277853cf8acb7620eb33d0a499ce0abe17106a
tree8670dd49b42e6bc51edc014482144fb864f77b05
parent1d44ec8507b7000879c48396332a1ff565e16086
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