From: Joe Thornber Date: Fri, 27 Jun 2014 19:29:04 +0000 (-0400) Subject: dm io: fix a race condition in the wake up code for sync_io X-Git-Tag: omap-for-v3.17/fixes-against-rc2~313^2~1 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=10f1d5d111e8aed46a0f1179faf9a3cf422f689e;p=pandora-kernel.git dm io: fix a race condition in the wake up code for sync_io There's a race condition between the atomic_dec_and_test(&io->count) in dec_count() and the waking of the sync_io() thread. If the thread is spuriously woken immediately after the decrement it may exit, making the on stack io struct invalid, yet the dec_count could still be using it. Fix this race by using a completion in sync_io() and dec_count(). Reported-by: Minfei Huang Signed-off-by: Joe Thornber Signed-off-by: Mike Snitzer Acked-by: Mikulas Patocka Cc: stable@vger.kernel.org --- Reading git-diff-tree failed