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

Commit bf8ada2d authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "mmc: block: Fix use after free issue with request pointer"

parents 04036d6a f8154847
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -2809,6 +2809,7 @@ static int mmc_blk_cmdq_issue_rw_rq(struct mmc_queue *mq, struct request *req)
	struct mmc_host *host = card->host;
	struct mmc_cmdq_context_info *ctx = &host->cmdq_ctx;
	struct mmc_cmdq_req *mc_rq;
	u8 active_small_sector_read = 0;
	int ret = 0;

	mmc_deferred_scaling(host);
@@ -2823,15 +2824,16 @@ static int mmc_blk_cmdq_issue_rw_rq(struct mmc_queue *mq, struct request *req)

	mc_rq = mmc_blk_cmdq_rw_prep(active_mqrq, mq);

	ret = mmc_blk_cmdq_start_req(card->host, mc_rq);

	if (!ret && (card->quirks & MMC_QUIRK_CMDQ_EMPTY_BEFORE_DCMD)) {
	if (card->quirks & MMC_QUIRK_CMDQ_EMPTY_BEFORE_DCMD) {
		unsigned int sectors = blk_rq_sectors(req);

		if (((sectors > 0) && (sectors < 8))
		    && (rq_data_dir(req) == READ))
			host->cmdq_ctx.active_small_sector_read_reqs++;
			active_small_sector_read = 1;
	}
	ret = mmc_blk_cmdq_start_req(card->host, mc_rq);
	if (!ret && active_small_sector_read)
		host->cmdq_ctx.active_small_sector_read_reqs++;
	/*
	 * When in SVS2 on low load scenario and there are lots of requests
	 * queued for CMDQ we need to wait till the queue is empty to scale