Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).

<!-- auto-changelog-above -->

#### [1.1.14](https://github.com/rdkcentral/control/compare/1.1.13...1.1.14)

> 22 April 2026

- Revert "RDKEMW-16763 : rf4ce init failure causes deadlock (#198)" [`#211`](https://github.com/rdkcentral/control/pull/211)


#### [1.1.13](https://github.com/rdkcentral/control/compare/1.1.12...1.1.13)

> 21 April 2026
Expand Down
28 changes: 2 additions & 26 deletions src/rf4ce/ctrlm_rf4ce_network.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
#include <algorithm>
#include <regex>
#include <limits.h>
#include <errno.h>
#include <sys/sysinfo.h>
#include "ctrlm.h"
#include "ctrlm_log.h"
Expand Down Expand Up @@ -412,31 +411,8 @@ ctrlm_hal_result_t ctrlm_obj_network_rf4ce_t::hal_init_request(GThread *ctrlm_ma

// Block until initialization is complete or a timeout occurs
XLOGD_INFO("Waiting for %s initialization...", name_get());
struct timespec timeout;
clock_gettime(CLOCK_REALTIME, &timeout);
timeout.tv_sec += 2; // this operation should complete in under 100 ms under normal circumstances

int sem_result = -1;
do {
errno = 0;
sem_result = sem_timedwait(&semaphore_, &timeout);
if(sem_result == -1 && errno == EINTR) {
XLOGD_INFO("interrupted");
} else {
break;
}
} while(1);

if(sem_result == -1) {
if(errno == ETIMEDOUT) {
XLOGD_ERROR("Timeout waiting for %s initialization", name_get());
} else {
XLOGD_ERROR("Error waiting for %s initialization: %s", name_get(), strerror(errno));
}
init_result_ = CTRLM_HAL_RESULT_ERROR;
} else {
sem_destroy(&semaphore_);
}
sem_wait(&semaphore_);
Comment on lines 412 to +414

Copilot AI Apr 22, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This block no longer enforces a timeout despite the comment saying it does, and sem_wait() can now block indefinitely if the HAL thread never invokes the init confirm callback (e.g., early init failure). Either reintroduce a bounded wait (and propagate a timeout error) or update the init path to guarantee the semaphore is always posted on all failure paths, so ctrlm_main_thread can't deadlock here.

Copilot uses AI. Check for mistakes.
sem_destroy(&semaphore_);
Comment on lines +414 to +415

Copilot AI Apr 22, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sem_wait() return value is ignored. If it returns -1 with EINTR, this code will still call sem_destroy(), and hal_init_confirm() may later sem_post() a destroyed semaphore (undefined behavior / possible crash). Please handle sem_wait() errors (retry on EINTR; otherwise set init_result_ and avoid destroying/using the semaphore incorrectly).

Copilot uses AI. Check for mistakes.

ready_ = (CTRLM_HAL_RESULT_SUCCESS == init_result_);

Expand Down
Loading