i40e: Fix use-after-free in i40e_client_subtask()
authorYunjian Wang <wangyunjian@huawei.com>
Mon, 12 Apr 2021 14:41:18 +0000 (22:41 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 19 May 2021 08:13:09 +0000 (10:13 +0200)
commit829a713450b8fb127cbabfc1244c1d8179ec5107
tree377b991ab624581a97cdf6a281d5a6d1e347335a
parent2692bf13e646b06343b8f7b48536a7270757f77e
i40e: Fix use-after-free in i40e_client_subtask()

[ Upstream commit 38318f23a7ef86a8b1862e5e8078c4de121960c3 ]

Currently the call to i40e_client_del_instance frees the object
pf->cinst, however pf->cinst->lan_info is being accessed after
the free. Fix this by adding the missing return.

Addresses-Coverity: ("Read from pointer after free")
Fixes: 7b0b1a6d0ac9 ("i40e: Disable iWARP VSI PETCP_ENA flag on netdev down events")
Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/intel/i40e/i40e_client.c