From: Dmitriy Matveichev <matveichev.dmitriy@gmail.com>
To: jgrajcia@cisco.com
Cc: dev@dpdk.org, Dmitriy Matveichev <matveichev.dmitriy@gmail.com>
Subject: [PATCH] net/memif: unregister callback on error in listener handler
Date: Thu, 6 Aug 2026 17:03:33 +0300 [thread overview]
Message-ID: <20260806140333.35422-1-matveichev.dmitriy@gmail.com> (raw)
Fix the crash if a memif client disconnects before a server says hello
Signed-off-by: Dmitriy Matveichev <matveichev.dmitriy@gmail.com>
---
If a memif client disconnects before a server says hello in memif_listener_handler we get errors
"MEMIF: memif_msg_send_from_queue(): sendmsg fail: Broken pipe.
EAL: PANIC in eal_intr_thread_main():
Error adding fd 59 epoll_ctl, Bad file descriptor".
During the error handling in this func a socket is freed but the eal_intr_thread_main knows nothing about it. The descriptor becomes invalid after close.
We should unregister callback from the eal_intr_thread_main loop and only after that we can safely free the socket.
.mailmap | 1 +
drivers/net/memif/memif_socket.c | 10 ++++++----
2 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/.mailmap b/.mailmap
index fcb3d1bb3f..d0148b0d9c 100644
--- a/.mailmap
+++ b/.mailmap
@@ -409,6 +409,7 @@ Ding Zhi <zhi.ding@6wind.com>
Diogo Behrens <diogo.behrens@huawei.com>
Dirk-Holger Lenz <dirk.lenz@ng4t.com>
Dmitri Epshtein <dima@marvell.com>
+Dmitriy Matveichev <matveichev.dmitriy@gmail.com>
Dmitriy Yakovlev <bombermag@gmail.com>
Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org>
Dmitry Kozlyuk <dmitry.kozliuk@gmail.com> <dkozlyuk@nvidia.com>
diff --git a/drivers/net/memif/memif_socket.c b/drivers/net/memif/memif_socket.c
index 649f8d0e61..898ad75fa6 100644
--- a/drivers/net/memif/memif_socket.c
+++ b/drivers/net/memif/memif_socket.c
@@ -878,14 +878,16 @@ memif_listener_handler(void *arg)
return;
error:
- if (sockfd >= 0) {
- close(sockfd);
- sockfd = -1;
- }
if (cc != NULL) {
+ rte_intr_callback_unregister(cc->intr_handle, memif_intr_handler,
+ cc);
rte_intr_instance_free(cc->intr_handle);
rte_free(cc);
}
+ if (sockfd >= 0) {
+ close(sockfd);
+ sockfd = -1;
+ }
}
static struct memif_socket *
--
2.53.0
next reply other threads:[~2026-08-06 14:04 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-06 14:03 Dmitriy Matveichev [this message]
2026-08-06 16:42 ` [PATCH] net/memif: unregister callback on error in listener handler Stephen Hemminger
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=20260806140333.35422-1-matveichev.dmitriy@gmail.com \
--to=matveichev.dmitriy@gmail.com \
--cc=dev@dpdk.org \
--cc=jgrajcia@cisco.com \
/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