mhi_bus: dev: uci: Fix read() race condition
If two processes are calling read() on the same MHI device at the same time, they might hit a race condition because the channel lock is unlocked for a time. This could allow both processes to cache a pointer to the same buffer, which could later cause memory corruption if both processes requeue the same buffer. We have to unlock the lock because its a spinlock and copy_to_user() can sleep, so create a mutex to serialize read accesses to the same channel. Change-Id: Ie9239d11962f1d3ca5e682ad2a534c0a88374328 Signed-off-by:Jeffrey Hugo <jhugo@codeaurora.org> Signed-off-by:
Pratyush Anand <pratanan@codeaurora.org>
Loading
Please sign in to comment