net/kni: fix crash caused by double stop
authorFerruh Yigit <ferruh.yigit@intel.com>
Tue, 26 Nov 2019 10:50:07 +0000 (10:50 +0000)
committerFerruh Yigit <ferruh.yigit@intel.com>
Tue, 26 Nov 2019 17:22:27 +0000 (18:22 +0100)
commit2ad5482b51eb26b17fe95e4d41ecbead76ee955c
tree23df0f5ca14101ec1ccff46a754d3889500365b5
parent64edb05e29c82260a0bd1000a20023d20c123e41
net/kni: fix crash caused by double stop

'close()' calls 'stop()' and 'stop()' cancels pthread without any check.
Calling 'stop()' & 'close()' sequentially tries to cancel pthread twice
which will cause a crash.

Adding a state check in 'stop()' before canceling the pthread to prevent
multiple stop.

Fixes: 696fbc7bb4fc ("net/kni: remove resources when port is closed")

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Tested-by: Yinan Wang <yinan.wang@intel.com>
drivers/net/kni/rte_eth_kni.c