net/failsafe: fix fd leak
authorYunjian Wang <wangyunjian@huawei.com>
Mon, 27 Apr 2020 10:44:19 +0000 (18:44 +0800)
committerFerruh Yigit <ferruh.yigit@intel.com>
Mon, 11 May 2020 20:27:39 +0000 (22:27 +0200)
commitb9663f60359296bcb6f0be8a3d6a2a838c77ee30
treededf39558f34ce2542f67af409fc7fdacaafbb59
parenta0f0de06d457753c94688d551a6e8659b4d4e041
net/failsafe: fix fd leak

Zero is a valid fd. The fd won't be closed thus leading fd leak,
when it is zero.

Also the service proxy is initialized at 0. This is assuming that all of
its fields are invalid at 0. The issue is that a file descriptor at 0 is
a valid one.

The value -1 is used as sentinel during cleanup. Initialize the RX proxy
file descriptor to -1.

Fixes: f234e5bd996d ("net/failsafe: register slaves Rx interrupts")
Fixes: 9e0360aebf23 ("net/failsafe: register as Rx interrupt mode")
Cc: stable@dpdk.org
Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
Signed-off-by: Gaetan Rivet <grive@u256.net>
Tested-by: Ali Alnubani <alialnu@mellanox.com>
drivers/net/failsafe/failsafe.c
drivers/net/failsafe/failsafe_intr.c
drivers/net/failsafe/failsafe_ops.c
drivers/net/failsafe/failsafe_private.h