OSDN Git Service

fbdev: bugfix for multiprocess defio
authorJaya Kumar <jayakumar.lkml@gmail.com>
Sat, 12 Jul 2008 20:47:51 +0000 (13:47 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sat, 12 Jul 2008 21:33:41 +0000 (14:33 -0700)
commitf31ad92f34913043cf008d6e479e92dfbaf02df1
tree5f57faa359a060c56bddac6f22c2993e2309d911
parent4fc89e3911aa5357b55b85b60c4beaeb8a48a290
fbdev: bugfix for multiprocess defio

This patch is a bugfix for how defio handles multiple processes manipulating
the same framebuffer.

Thanks to Bernard Blackham for identifying this bug.

It occurs when two applications mmap the same framebuffer and concurrently
write to the same page.  Normally, this doesn't occur since only a single
process mmaps the framebuffer.  The symptom of the bug is that the mapping
applications will hang.  The cause is that defio incorrectly tries to add the
same page twice to the pagelist.  The solution I have is to walk the pagelist
and check for a duplicate before adding.  Since I needed to walk the pagelist,
I now also keep the pagelist in sorted order.

Signed-off-by: Jaya Kumar <jayakumar.lkml@gmail.com>
Cc: Bernard Blackham <bernard@largestprime.net>
Cc: <stable@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/video/fb_defio.c