Commit 78716bd0 authored by Jeffrey Hugo's avatar Jeffrey Hugo Committed by Pratyush Anand
Browse files

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: default avatarJeffrey Hugo <jhugo@codeaurora.org>
Signed-off-by: default avatarPratyush Anand <pratanan@codeaurora.org>
parent f7bd6cc1
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment