summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWill McVicker <willmcvicker@google.com>2022-04-25 16:50:10 -0700
committerWill McVicker <willmcvicker@google.com>2022-04-25 17:07:50 -0700
commit78cadc9fccf3aeaf69f5a952d381b721718a9485 (patch)
tree97c1283be039c38becea59450e55a3dd7d285e95
parent610de956f4b05de85c838a8fa5306958897bbb2d (diff)
downloadbroadcom-78cadc9fccf3aeaf69f5a952d381b721718a9485.tar.gz
Fix kfifo_out return value check
This fixes commit 24ba4efd42fe ("Check return value of kfifo_out") which exposes a bug in the bluetooth HAL that causes a SIGABRT due to an uncaught exception from trying to parse a negative number using stoul. This SIGABRT crashes the bluetooth HAL. So to workaround this, instead of returning an error, return 0 on error which is what happens if this procfs file doesn't exist. Fixes: 24ba4efd42fe ("Check return value of kfifo_out") Bug: 230397443 Signed-off-by: Will McVicker <willmcvicker@google.com> Change-Id: I8058a32985b6e7d5d38e216ee1032c8178edd4b3
-rw-r--r--nitrous.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/nitrous.c b/nitrous.c
index d49ae60..f311035 100644
--- a/nitrous.c
+++ b/nitrous.c
@@ -266,10 +266,8 @@ static int nitrous_proc_show(struct seq_file *m, void *v)
break;
case PROC_TIMESYNC:
ret = kfifo_out(&lpm->timestamp_queue, &timestamp, sizeof(ktime_t));
- if (ret != sizeof(ktime_t)) {
- dev_err(lpm->dev, "failed to get the timestamp, ret=%u\n", ret);
- return -EINVAL;
- }
+ if (ret != sizeof(ktime_t))
+ timestamp = 0;
seq_printf(m, "%lld", ktime_to_us(timestamp));
break;
default: