Re: [PATCH] ashmem: Fix lockdep issue during llseek

From: Al Viro
Date: Fri Jan 26 2018 - 14:40:00 EST


On Fri, Jan 26, 2018 at 11:23:47AM -0800, Joel Fernandes wrote:

> I was just trying to be careful with the least intrusive solution
> since I'm not the original author of the driver.

Sure, but that needs a proof that it *is* a solution...

> But one usecase for the mutex is with concurrent lseeks, you can end
> up with a file->f_pos that is different from the latest update to
> asma->file->f_pos. A barrier could fix this it too though. Any
> thoughts?

lseek(2) is serialized against lseek(2) and read(2) on the same struct
file - see fdget_pos() for details.

ashmem_mutex really does look like an overkill - something much lighter
should serve just fine...