net/cxgbe: free resources during uninit
authorRahul Lakkireddy <rahul.lakkireddy@chelsio.com>
Sat, 12 May 2018 11:50:00 +0000 (17:20 +0530)
committerFerruh Yigit <ferruh.yigit@intel.com>
Mon, 14 May 2018 21:32:23 +0000 (22:32 +0100)
commitb84bcf40190e85f620920711b728fa36ce947f2b
treea6b1a50947c17c4913ae9018c48384ce1f375ba4
parent97b2217ae5bcdd90e9265790de388e7febeee3bd
net/cxgbe: free resources during uninit

Move freeing up resources from dev_close() to dev_uninit(). This fixes
NULL pointer de-reference when accessing adapter context needed by
other ports under same PF, but had been freed up by the first port.
This can happen if only the first port is started up and the check
to free up all resources is still satisfied. When dev_close is
called for other ports, adapter context is NULL since it was freed
up by the first port.

Thus, by moving to dev_uninit() all the ports can be teared down
safely without need for extra checks.

Fixes: 2195df6d11bd ("net/cxgbe: rework ethdev device allocation")

Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
Signed-off-by: Kumar Sanghvi <kumaras@chelsio.com>
drivers/net/cxgbe/cxgbe_ethdev.c