staging: android: logger: Fix log corruption regression
authorDaniel Thompson <daniel.thompson@linaro.org>
Mon, 27 Oct 2014 18:51:43 +0000 (18:51 +0000)
committerKarol Lewandowski <k.lewandowsk@samsung.com>
Thu, 22 Apr 2021 13:12:42 +0000 (15:12 +0200)
commit19207f28f782b95d79e2315966584e9b7bff0687
treed5334e42220070a192a2cdefb4c1085379997196
parent1309e102430944ec73f5f10802107c17f519b4b1
staging: android: logger: Fix log corruption regression

Since commit cd678fce4280 ("switch logger to ->write_iter()"), any
attempt to write to the log results in the log data being written over
its own metadata, thus rendering the log unreadable.

The problem was first detected when I ran an Android userspace on the
v3.18-rc1 kernel. However the issue can also be observed with a
non-Android userspace by using echo/cat to write to/from /dev/log_main .

This patch resolves the problem by using a temporary to track the status
of not-yet-committed writes to the log buffer.

Signed-off-by: Daniel Thompson <daniel.thompson@linaro.org>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
drivers/staging/android/logger.c