diff options
author | Evan Chu <evanchu@broadcom.com> | 2013-06-24 12:48:18 -0400 |
---|---|---|
committer | Martijn Coenen <maco@google.com> | 2013-08-05 08:56:45 -0700 |
commit | c2eeefe7d48a7809b0e2c1aa7b4c6f78605159b9 (patch) | |
tree | 6444c3239fc78393d4c538a3a375a3acb49c98b3 | |
parent | 91ada91fa991b4df5372a19a2cf81f074b298712 (diff) | |
download | libnfc-nci-c2eeefe7d48a7809b0e2c1aa7b4c6f78605159b9.tar.gz |
Fix deadlock in GKI_getbuf when out of buffer.
By Kevin Park. GKI_getbuf is executed in critical section.
Sometimes, when GKI getbuf fails due to low memory,
code logic in GKI_getbuf just returns NULL without releasing lock.
This introduces deadlock situation.
So fixed the code to call GKI_enable before returning.
Increasing GKI buf pool size for the
specific condition like system very busy on first boot.
Change-Id: I8c7de8d0f472f5dfa41a43c08c30025de4e073c4
-rw-r--r-- | halimpl/bcm2079x/gki/common/gki_buffer.c | 2 | ||||
-rw-r--r-- | halimpl/bcm2079x/include/buildcfg_hal.h | 2 | ||||
-rw-r--r-- | src/gki/common/gki_buffer.c | 2 |
3 files changed, 6 insertions, 0 deletions
diff --git a/halimpl/bcm2079x/gki/common/gki_buffer.c b/halimpl/bcm2079x/gki/common/gki_buffer.c index 10a816a..555bc4b 100644 --- a/halimpl/bcm2079x/gki/common/gki_buffer.c +++ b/halimpl/bcm2079x/gki/common/gki_buffer.c @@ -407,6 +407,7 @@ void *GKI_getbuf (UINT16 size) if(Q->p_first == 0 && gki_alloc_free_queue(i) != TRUE) { GKI_TRACE_ERROR_0("GKI_getbuf() out of buffer"); + GKI_enable(); return NULL; } #endif @@ -415,6 +416,7 @@ void *GKI_getbuf (UINT16 size) { /* gki_alloc_free_queue() failed to alloc memory */ GKI_TRACE_ERROR_0("GKI_getbuf() fail alloc free queue"); + GKI_enable(); return NULL; } diff --git a/halimpl/bcm2079x/include/buildcfg_hal.h b/halimpl/bcm2079x/include/buildcfg_hal.h index 590438b..cd21c2c 100644 --- a/halimpl/bcm2079x/include/buildcfg_hal.h +++ b/halimpl/bcm2079x/include/buildcfg_hal.h @@ -26,5 +26,7 @@ #define GKI_RUNNER_HAL_TASK 2 //execute GKI_run(), which runs forever #define GKI_MAX_TASKS 3 //total of 3 tasks +#define GKI_BUF0_MAX 16 +#define GKI_BUF1_MAX 16 #define NFC_HAL_PRM_POST_I2C_FIX_DELAY (500) diff --git a/src/gki/common/gki_buffer.c b/src/gki/common/gki_buffer.c index 10a816a..555bc4b 100644 --- a/src/gki/common/gki_buffer.c +++ b/src/gki/common/gki_buffer.c @@ -407,6 +407,7 @@ void *GKI_getbuf (UINT16 size) if(Q->p_first == 0 && gki_alloc_free_queue(i) != TRUE) { GKI_TRACE_ERROR_0("GKI_getbuf() out of buffer"); + GKI_enable(); return NULL; } #endif @@ -415,6 +416,7 @@ void *GKI_getbuf (UINT16 size) { /* gki_alloc_free_queue() failed to alloc memory */ GKI_TRACE_ERROR_0("GKI_getbuf() fail alloc free queue"); + GKI_enable(); return NULL; } |