drm/omap: fix leak & crash in omap_gem_op_sync()
authorTomi Valkeinen <tomi.valkeinen@ti.com>
Thu, 3 Dec 2015 15:56:08 +0000 (17:56 +0200)
committerPraneeth Bajjuri <praneeth@ti.com>
Sat, 5 Dec 2015 16:48:48 +0000 (11:48 -0500)
commitddfa43844a3ef6f110fca7c1d99b52f072830d92
tree4085d7b2622cf7b2d8c032e0b7c3635e8b844868
parentc3aae82161b32f9f458b660897bfb086ea970fa2
drm/omap: fix leak & crash in omap_gem_op_sync()

If omap_gem_op_sync is interrupted while it waits for notify to finish,
two issues occur:

 * the waiter struct is not freed
 * the wait condition is on stack, so on return of the
   waiting function, the stack is corrupted

Therefore, the wait is made non-interruptible. So, when omap_gem_op_sync
returns, it is gurranteed that the gem operation is complete.

The downside is that if, for whatever reason, the notify never happens,
the thread waits forever. Fixing this properly would require large
changes to omap_gem.c, and as we should always get a notify, this seems
like an acceptable fix for the time being.

Original patch by Subhajit Paul <subhajit_paul@ti.com>

Change-Id: I143e3a1a259cfc0961821f5a65b1fddf182efa60
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
drivers/gpu/drm/omapdrm/omap_gem.c