Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8d771e9b authored by Asutosh Das's avatar Asutosh Das Committed by Matt Wagantall
Browse files

mmc: block: fix race in deferred resume



The actual resume takes place when a request is received. In a
situation when mmcqd and qseecomd(rpmb) both try to resume the
device, a race is ensued. This is because mmcqd first resumes
the device and then claims the host. Ideally, if resume is in
progress in one context the resume in the other context should
be cancelled.
Claim the host before resuming the device in mmcqd context.

CRs-fixed: 697018
Change-Id: I11d33e642a9b2022f77277196de128c9ac78d334
Signed-off-by: default avatarAsutosh Das <asutoshd@codeaurora.org>
[merez@codeaurora.org: fix conflicts due to changes in 3.14 code]
Signed-off-by: default avatarMaya Erez <merez@codeaurora.org>
parent 6d7110bf
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -2573,15 +2573,15 @@ static int mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req)
	unsigned long flags;
	unsigned int cmd_flags = req ? req->cmd_flags : 0;

	if (req && !mq->mqrq_prev->req)
		/* claim host only for the first request */
		mmc_get_card(card);

#ifdef CONFIG_MMC_BLOCK_DEFERRED_RESUME
	if (mmc_bus_needs_resume(card->host))
		mmc_resume_bus(card->host);
#endif

	if (req && !mq->mqrq_prev->req)
		/* claim host only for the first request */
		mmc_get_card(card);

	ret = mmc_blk_part_switch(card, md);
	if (ret) {
		if (req) {