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>
}
priv = PRIV(dev);
priv->data = dev->data;
+ priv->rxp = FS_RX_PROXY_INIT;
dev->dev_ops = &failsafe_ops;
dev->data->mac_addrs = &PRIV(dev)->mac_addrs[0];
dev->data->dev_link = eth_link;
free(priv->rxp.evec);
priv->rxp.evec = NULL;
}
- if (priv->rxp.efd > 0) {
+ if (priv->rxp.efd >= 0) {
close(priv->rxp.efd);
priv->rxp.efd = -1;
}
rxq = queue;
dev = &rte_eth_devices[rxq->priv->data->port_id];
fs_lock(dev, 0);
- if (rxq->event_fd > 0)
+ if (rxq->event_fd >= 0)
close(rxq->event_fd);
FOREACH_SUBDEV_STATE(sdev, i, dev, DEV_ACTIVE) {
if (ETH(sdev)->data->rx_queues != NULL &&
enum rxp_service_state sstate;
};
+#define FS_RX_PROXY_INIT (struct rx_proxy){ \
+ .efd = -1, \
+ .evec = NULL, \
+ .sid = 0, \
+ .scid = 0, \
+ .sstate = SS_NO_SERVICE, \
+}
+
struct rxq {
struct fs_priv *priv;
uint16_t qid;