net/tap: fix unregistering callback with invalid fd

tap_intr_handle_set() called by tap_dev_start(), and if LSC is disabled
(dev_conf.intr_conf.lsc == 0), it tries to unregister interrupt
callback without checking the interrupt file descriptor.

Fixes: c0bddd3a05 ("net/tap: add link status notification")
Cc: stable@dpdk.org

Signed-off-by: Vipin Varghese <vipin.varghese@intel.com>
Acked-by: Pascal Mazon <pascal.mazon@6wind.com>
This commit is contained in:
Vipin Varghese 2017-09-18 19:47:35 +01:00 committed by Ferruh Yigit
parent 95c7ff0548
commit d8f759a0ea

View File

@ -1132,10 +1132,11 @@ tap_intr_handle_set(struct rte_eth_dev *dev, int set)
/* In any case, disable interrupt if the conf is no longer there. */
if (!dev->data->dev_conf.intr_conf.lsc) {
if (pmd->intr_handle.fd != -1)
if (pmd->intr_handle.fd != -1) {
nl_final(pmd->intr_handle.fd);
rte_intr_callback_unregister(
&pmd->intr_handle, tap_dev_intr_handler, dev);
rte_intr_callback_unregister(&pmd->intr_handle,
tap_dev_intr_handler, dev);
}
return 0;
}
if (set) {