* [PATCH] mmc: block: fixed NULL pointer dereference
@ 2011-07-13 8:02 Jaehoon Chung
2011-07-13 9:56 ` Per Forlin
0 siblings, 1 reply; 2+ messages in thread
From: Jaehoon Chung @ 2011-07-13 8:02 UTC (permalink / raw)
To: linux-mmc; +Cc: Chris Ball, Kyungmin Park, Per Forlin, Philip Rakity
Hi.
I send to mailing for [RFC] Kernel NULL pointer dereference.
This patch is fixed it.
In similar case, when discard request, check condition and
performed mmc_blk_issue_rw_rq(mq, NULL) for ongoing async transfer.
But When flush request, entered the mmc_blk_issue_flush() then return.
(then didn't complete ongoing aync transfer).
I think that need to complete for ongoing aync transfer before flush request.
I tested with this patch, it's working fine.
(SDHCI controller, eMMC4.41)
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
---
drivers/mmc/card/block.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
index 38d0149..1ff5486 100644
--- a/drivers/mmc/card/block.c
+++ b/drivers/mmc/card/block.c
@@ -1200,6 +1200,9 @@ static int mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req)
else
ret = mmc_blk_issue_discard_rq(mq, req);
} else if (req && req->cmd_flags & REQ_FLUSH) {
+ /* complete ongoing async transfer before issuing flush */
+ if (card->host->areq)
+ mmc_blk_issue_rw_rq(mq, NULL);
ret = mmc_blk_issue_flush(mq, req);
} else {
ret = mmc_blk_issue_rw_rq(mq, req);
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] mmc: block: fixed NULL pointer dereference
2011-07-13 8:02 [PATCH] mmc: block: fixed NULL pointer dereference Jaehoon Chung
@ 2011-07-13 9:56 ` Per Forlin
0 siblings, 0 replies; 2+ messages in thread
From: Per Forlin @ 2011-07-13 9:56 UTC (permalink / raw)
To: Jaehoon Chung; +Cc: linux-mmc, Chris Ball, Kyungmin Park, Philip Rakity
On 13 July 2011 10:02, Jaehoon Chung <jh80.chung@samsung.com> wrote:
> Hi.
>
> I send to mailing for [RFC] Kernel NULL pointer dereference.
> This patch is fixed it.
>
> In similar case, when discard request, check condition and
> performed mmc_blk_issue_rw_rq(mq, NULL) for ongoing async transfer.
>
> But When flush request, entered the mmc_blk_issue_flush() then return.
> (then didn't complete ongoing aync transfer).
>
> I think that need to complete for ongoing aync transfer before flush request.
>
I did consider this when I added the check for discard but I didn't
realize it is necessary for flush too.
There is no real downside of completing the async request before flush
in terms of performance anyway.
Thanks for catching this bug.
> @@ -1200,6 +1200,9 @@ static int mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req)
> else
> ret = mmc_blk_issue_discard_rq(mq, req);
> } else if (req && req->cmd_flags & REQ_FLUSH) {
> + /* complete ongoing async transfer before issuing flush */
> + if (card->host->areq)
> + mmc_blk_issue_rw_rq(mq, NULL);
These 2 lines are the same as for the discard condition. I still
prefer 2 lines of repeating code rather than one big if-statement
covering both discard and flush.
Acked-by: Per Forlin <per.forlin@linaro.org>
Regards,
Per
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-07-13 9:56 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-13 8:02 [PATCH] mmc: block: fixed NULL pointer dereference Jaehoon Chung
2011-07-13 9:56 ` Per Forlin
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.