net/memif: unregister callback on error in listener handler
PATCH 1/1 net/memif: unregister callback on error in listener handler
Fix the crash if a memif client disconnects before a server says hello
---
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(-)
.mailmap +1 -0
@@ -409,6 +409,7 @@ Ding Zhi <[email protected]> Diogo Behrens <[email protected]> Dirk-Holger Lenz <[email protected]> Dmitri Epshtein <[email protected]> +Dmitriy Matveichev <[email protected]> Dmitriy Yakovlev <[email protected]> Dmitry Eremin-Solenikov <[email protected]> Dmitry Kozlyuk <[email protected]> <[email protected]>
drivers/net/memif/memif_socket.c +6 -4
@@ -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 *
Signature · 1 line
2.53.0
Stephen Hemminger
AppliedQuoted 4 lines · On Thu, 6 Aug 2026 17:03:33 +0300 Dmitriy Matveichev…
Fix the crash if a memif client disconnects before a server says hello
Signed-off-by Dmitriy Matveichev <[email protected]>---
Applied to next-net; added missing Fixes: line