public inbox for dev@dpdk.org
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: dev@dpdk.org
Cc: Stephen Hemminger <stephen@networkplumber.org>,
	stable@dpdk.org, Robin Jarry <rjarry@redhat.com>
Subject: [PATCH] net/tap: avoid using netlink socket if closed
Date: Fri,  3 Apr 2026 12:26:35 -0700	[thread overview]
Message-ID: <20260403192635.320320-1-stephen@networkplumber.org> (raw)

Coverity flagged that nlsk_fd could be negative when passed
to tap_nl_set_flags() during device close.

Coverity issue: 502576
Fixes: b5d76639551e ("net/tap: replace ioctl with Netlink")
Cc: stable@dpdk.org
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 drivers/net/tap/rte_eth_tap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c
index a5d460a0b3..ba9aef74c0 100644
--- a/drivers/net/tap/rte_eth_tap.c
+++ b/drivers/net/tap/rte_eth_tap.c
@@ -1124,7 +1124,7 @@ tap_dev_close(struct rte_eth_dev *dev)
 		}
 	}
 
-	if (internals->remote_if_index) {
+	if (internals->remote_if_index != 0 && internals->nlsk_fd != -1) {
 		/* Restore initial remote state */
 		int ret = tap_nl_set_flags(internals->nlsk_fd, internals->remote_if_index,
 					   internals->remote_initial_flags, 1);
-- 
2.53.0


             reply	other threads:[~2026-04-03 19:26 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-03 19:26 Stephen Hemminger [this message]
2026-04-05 18:23 ` [PATCH] net/tap: avoid using netlink socket if closed Robin Jarry

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260403192635.320320-1-stephen@networkplumber.org \
    --to=stephen@networkplumber.org \
    --cc=dev@dpdk.org \
    --cc=rjarry@redhat.com \
    --cc=stable@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox