caif: fix memory leak in cfctrl_linkup_request()
authorZhengchao Shao <shaozhengchao@huawei.com>
Wed, 4 Jan 2023 06:51:46 +0000 (14:51 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 12 Jan 2023 11:02:33 +0000 (12:02 +0100)
commit3ad47c8aa5648226184415e4a0cb1bf67ffbfd48
tree0ef899fe4daa6f4c12b6d1257ffcd7aa0c94bb21
parent7d242f4a0c8319821548c7176c09a6e0e71f223c
caif: fix memory leak in cfctrl_linkup_request()

[ Upstream commit fe69230f05897b3de758427b574fc98025dfc907 ]

When linktype is unknown or kzalloc failed in cfctrl_linkup_request(),
pkt is not released. Add release process to error path.

Fixes: b482cd2053e3 ("net-caif: add CAIF core protocol stack")
Fixes: 8d545c8f958f ("caif: Disconnect without waiting for response")
Signed-off-by: Zhengchao Shao <shaozhengchao@huawei.com>
Reviewed-by: Jiri Pirko <jiri@nvidia.com>
Link: https://lore.kernel.org/r/20230104065146.1153009-1-shaozhengchao@huawei.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/caif/cfctrl.c