🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: linux.kernel.netdev
1 messages
1 total messages Started by Stephen Hemminger Thu, 12 Nov 2026 19:59
[PATCH iproute2 01/11] ss: fix double close on sock_diag send failure
#15381
Author: Stephen Hemminger
Date: Thu, 12 Nov 2026 19:59
38 lines
11802 bytes
If sendmsg() fails, tcpdiag_send() and sockdiag_send() close the
netlink socket, then inet_show_netlink() closes it again via
rtnl_close(). The second close clobbers errno with EBADF.

Leave closing the socket to the caller.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 misc/ss.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/misc/ss.c b/misc/ss.c
index cffee883..674ed8e8 100644
--- a/misc/ss.c
+++ b/misc/ss.c
@@ -3931,10 +3931,8 @@ static int tcpdiag_send(int fd, int protocol, struct filter *f)
 		.msg_iovlen = iovlen,
 	};
 
-	if (sendmsg(fd, &msg, 0) < 0) {
-		close(fd);
+	if (sendmsg(fd, &msg, 0) < 0)
 		return -1;
-	}
 
 	return 0;
 }
@@ -4026,7 +4024,6 @@ static int sockdiag_send(int family, int fd, int protocol, struct filter *f)
 
 	if (sendmsg(fd, &msg, 0) < 0) {
 		free(bpf_rta);
-		close(fd);
 		return -1;
 	}
 
-- 
2.53.0
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads