diff options
author | Marco Nelissen <marcone@google.com> | 2022-05-17 14:25:34 -0700 |
---|---|---|
committer | Ji Soo Shin <jisshin@google.com> | 2023-03-06 23:13:35 +0000 |
commit | 36d7af334ec1418e1734e2370bdc0db99dbbd513 (patch) | |
tree | aff966af2eaaecfedb5c030607a8891f031ffe50 | |
parent | 1fde0d6e4a7d7a92c22660a80ec188d9e6d9a9b8 (diff) | |
download | trusty-36d7af334ec1418e1734e2370bdc0db99dbbd513.tar.gz |
ANDROID: trusty-log: fix poll check for data availability.
filp->f_pos may not match the position that is used internally
by seq_file, which can then result in poll() returning immediately
even when no data is available.
Bug: 232472073
Test: boot, logcat
Signed-off-by: Marco Nelissen <marcone@google.com>
Change-Id: I4fdfafce354c9995b1dcc7e93084dd4732225454
-rw-r--r-- | drivers/trusty/trusty-log.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/trusty/trusty-log.c b/drivers/trusty/trusty-log.c index 16861e7..8812cec 100644 --- a/drivers/trusty/trusty-log.c +++ b/drivers/trusty/trusty-log.c @@ -640,15 +640,15 @@ static unsigned int trusty_log_sfile_dev_poll(struct file *filp, log = s->log; /* - * Userspace has read up to filp->f_pos so far. Update klog_sink + * Userspace has read up to sfile->index so far. Update klog_sink * to indicate that, so that we don't end up dumping the entire * Trusty log in case of panic. Only do this when not logging to * klog_sink, since logging to klog_sink already updates this. */ if (log_to_dmesg_param != ALWAYS) - s->klog_sink.last_successful_next = (u32)filp->f_pos; + s->klog_sink.last_successful_next = (u32)sfile->index; - if (log->put != (u32)filp->f_pos) { + if (log->put != (u32)sfile->index) { /* data ready to read */ return EPOLLIN | EPOLLRDNORM; } |