From 5c00be05eb53572307c2840bd602a0f5016e1687 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=B5=9C=EC=86=A1=EC=95=84?= Date: Tue, 6 Apr 2021 10:39:20 +0900 Subject: [PATCH] BSR-750 fix potential hang when using send buffer in protocol c --- bsr/bsr_send_buf.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/bsr/bsr_send_buf.c b/bsr/bsr_send_buf.c index 3b0c80e0..4507e901 100644 --- a/bsr/bsr_send_buf.c +++ b/bsr/bsr_send_buf.c @@ -577,9 +577,10 @@ int send_buf_thread(void *p) while (!buffering_attr->send_buf_kill_event) { wait_event_timeout_ex(buffering_attr->ring_buf_event, test_bit(RING_BUF_EVENT, &buffering_attr->flags), timeo, ret); - if(test_bit(RING_BUF_EVENT, &buffering_attr->flags)) + // BSR-750 fix potential hang when using send buffer in protocol c + // RING_BUF_EVENT flag setting race between send_buf_thread() and send_buf() + if(test_and_clear_bit(RING_BUF_EVENT, &buffering_attr->flags)) do_send(socket, buffering_attr->bab, socket->sk->sk_sndtimeo); - clear_bit(RING_BUF_EVENT, &buffering_attr->flags); } bsr_info(NO_OBJECT,"send_buf_killack_event!");