]> git.baikalelectronics.ru Git - kernel.git/commit
mmc: dw_mmc: fix race with request and removal
authorJames Hogan <james.hogan@imgtec.com>
Fri, 24 Jun 2011 12:55:10 +0000 (13:55 +0100)
committerChris Ball <cjb@laptop.org>
Wed, 20 Jul 2011 21:20:58 +0000 (17:20 -0400)
commit9145faf15fd7a2df3df2e63b9656bddc9a097f86
tree972f231756e8e766aa367689085a2834c7f6fcb4
parent888f9649ff1c07048d6494b434407454c8c36fb3
mmc: dw_mmc: fix race with request and removal

When a request is made, the card presence is checked and the request is
queued. These two parts must be atomic with respect to card removal, or
a card removal could be handled in between, and the new request wouldn't
get cancelled until another card was inserted. Therefore move the
spinlock protection from dw_mci_queue_request() up into dw_mci_request()
to cover the presence check.

Note that the test_bit() used for the presence check isn't atomic
itself, so should have been protected by a spinlock anyway.

Signed-off-by: James Hogan <james.hogan@imgtec.com>
Acked-by: Will Newton <will.newton@imgtec.com>
Signed-off-by: Chris Ball <cjb@laptop.org>
drivers/mmc/host/dw_mmc.c