gfx: drv: Clean pending page flip events when device is closed
authorPauli Nieminen <pauli.nieminen@linux.intel.com>
Tue, 3 Jan 2012 15:36:44 +0000 (17:36 +0200)
committerMarkus Lehtonen <markus.lehtonen@linux.intel.com>
Tue, 3 Jul 2012 09:29:24 +0000 (12:29 +0300)
commit92f9562dec8e0b4d140d9bdfa183e46f563b6242
treebe24486e36ba69ad3fe095db9aefcadadbce5617
parent54f96a5b6bc0ec7798339b4c7a68dce1d91f75d9
gfx: drv: Clean pending page flip events when device is closed

If userspace closes the device node with pending page flips driver keeps
a pointer to file private that is already freed. Following backtrace
shows the oops happening.

[ 643.828884] BUG: unable to handle kernel paging request at 6b6b6b6b
[ 643.835082] IP: [<c1224b6e>] __list_add+0x2a/0x5c
[ 643.888465] EIP is at __list_add+0x2a/0x5c
[ 643.943931] Call Trace:
[ 643.946376] [<c139c0d8>] psb_intel_flip_complete+0x71/0xcb
[ 643.951937] [<c139c1c8>] sync_callback+0x96/0x9f
[ 643.956631] [<c1371310>] PVRSRVCallbackOnSync+0x37/0xb7
[ 643.961934] [<c139c132>] ? psb_intel_flip_complete+0xcb/0xcb
[ 643.967673] [<c139c049>] psb_intel_crtc_page_flip+0xa1/0xbf
[ 643.973324] [<c1282f5d>] drm_mode_page_flip_ioctl+0x13f/0x190
[ 643.979151] [<c12778bf>] drm_ioctl+0x276/0x332

To cleanup pending events driver has to keep linked list of pending
flips in file private. When file is closed all events in pending flips
for the file are cleared.

To avoid race conditions dev->event_lock is used to protect pending
flips lists from parallel access.

Issue: KER-47
Signed-off-by: Pauli Nieminen <pauli.nieminen@linux.intel.com>
CC: Rahul Verman <rahul.verma@intel.com>
Acked-by: Sean V Kelley <sean.v.kelley@intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
drivers/staging/mrst/drv/psb_drv.h
drivers/staging/mrst/drv/psb_page_flip.c
drivers/staging/mrst/drv/psb_page_flip.h
drivers/staging/mrst/imgv/psb_ttm_glue.c