diff options
author | Jarkko Lavinen <jarkko.lavinen@nokia.com> | 2009-09-22 19:44:46 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-09-23 10:39:34 -0400 |
commit | a3f406f861456987c9fce8cfa0a00d07b16cdec0 (patch) | |
tree | 8ad5589b8a4aa5c4cdd95dcdeae0323cbee143aa /drivers/mmc/host | |
parent | a6b2240da2b090874095832afc7eb9ed2968b27f (diff) |
omap_hsmmc: fix scatter-gather list sanity checking
Do not use host->dma_len when it is uninitialzed. Finish the request with
an error if the mmc_omap_prepare_data() fails.
Signed-off-by: Jarkko Lavinen <jarkko.lavinen@nokia.com>
Signed-off-by: Adrian Hunter <adrian.hunter@nokia.com>
Acked-by: Matt Fleming <matt@console-pimps.org>
Cc: Ian Molton <ian@mnementh.co.uk>
Cc: "Roberto A. Foglietta" <roberto.foglietta@gmail.com>
Cc: Jarkko Lavinen <jarkko.lavinen@nokia.com>
Cc: Denis Karpov <ext-denis.2.karpov@nokia.com>
Cc: Pierre Ossman <pierre@ossman.eu>
Cc: Philip Langdale <philipl@overt.org>
Cc: "Madhusudhan" <madhu.cr@ti.com>
Cc: <linux-mmc@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/mmc/host')
-rw-r--r-- | drivers/mmc/host/omap_hsmmc.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c index 9599dd126ac8..f588deff8b2c 100644 --- a/drivers/mmc/host/omap_hsmmc.c +++ b/drivers/mmc/host/omap_hsmmc.c | |||
@@ -878,7 +878,7 @@ mmc_omap_start_dma_transfer(struct mmc_omap_host *host, struct mmc_request *req) | |||
878 | struct mmc_data *data = req->data; | 878 | struct mmc_data *data = req->data; |
879 | 879 | ||
880 | /* Sanity check: all the SG entries must be aligned by block size. */ | 880 | /* Sanity check: all the SG entries must be aligned by block size. */ |
881 | for (i = 0; i < host->dma_len; i++) { | 881 | for (i = 0; i < data->sg_len; i++) { |
882 | struct scatterlist *sgl; | 882 | struct scatterlist *sgl; |
883 | 883 | ||
884 | sgl = data->sg + i; | 884 | sgl = data->sg + i; |
@@ -1021,10 +1021,20 @@ static int omap_mmc_disable(struct mmc_host *mmc, int lazy) | |||
1021 | static void omap_mmc_request(struct mmc_host *mmc, struct mmc_request *req) | 1021 | static void omap_mmc_request(struct mmc_host *mmc, struct mmc_request *req) |
1022 | { | 1022 | { |
1023 | struct mmc_omap_host *host = mmc_priv(mmc); | 1023 | struct mmc_omap_host *host = mmc_priv(mmc); |
1024 | int err; | ||
1024 | 1025 | ||
1025 | WARN_ON(host->mrq != NULL); | 1026 | WARN_ON(host->mrq != NULL); |
1026 | host->mrq = req; | 1027 | host->mrq = req; |
1027 | mmc_omap_prepare_data(host, req); | 1028 | err = mmc_omap_prepare_data(host, req); |
1029 | if (err) { | ||
1030 | req->cmd->error = err; | ||
1031 | if (req->data) | ||
1032 | req->data->error = err; | ||
1033 | host->mrq = NULL; | ||
1034 | mmc_request_done(mmc, req); | ||
1035 | return; | ||
1036 | } | ||
1037 | |||
1028 | mmc_omap_start_command(host, req->cmd, req->data); | 1038 | mmc_omap_start_command(host, req->cmd, req->data); |
1029 | } | 1039 | } |
1030 | 1040 | ||