diff options
author | Bhuvanesh Surachari <bhuvanesh_surachari@mentor.com> | 2014-12-01 02:23:02 -0500 |
---|---|---|
committer | Ulf Hansson <ulf.hansson@linaro.org> | 2014-12-05 04:33:17 -0500 |
commit | fdb409f636cd6fc3ac4e2f9c880402860e738554 (patch) | |
tree | 34a579006f5fe970ec9646e5eaf882d3af4345a3 | |
parent | 9d65cb88e5979d43f47c899601353ca61973ba90 (diff) |
mmc: queue: Improve error handling during allocation of bounce buffers
Allocation of previous bounce buffer in mmc_init_queue when the current
bounce buffer allocation fails was leading to a crash later in
__blk_segment_map_sg. Error handling is improved by allocating previous
bounce buffer only if the current bounce buffer allocation succeeds.
Signed-off-by: Bhuvanesh Surachari <bhuvanesh_surachari@mentor.com>
Signed-off-by: Harish Jenny K N <harish_kandiga@mentor.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
-rw-r--r-- | drivers/mmc/card/queue.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/drivers/mmc/card/queue.c b/drivers/mmc/card/queue.c index cfa6110632c3..236d194c2883 100644 --- a/drivers/mmc/card/queue.c +++ b/drivers/mmc/card/queue.c | |||
@@ -232,13 +232,15 @@ int mmc_init_queue(struct mmc_queue *mq, struct mmc_card *card, | |||
232 | if (!mqrq_cur->bounce_buf) { | 232 | if (!mqrq_cur->bounce_buf) { |
233 | pr_warn("%s: unable to allocate bounce cur buffer\n", | 233 | pr_warn("%s: unable to allocate bounce cur buffer\n", |
234 | mmc_card_name(card)); | 234 | mmc_card_name(card)); |
235 | } | 235 | } else { |
236 | mqrq_prev->bounce_buf = kmalloc(bouncesz, GFP_KERNEL); | 236 | mqrq_prev->bounce_buf = |
237 | if (!mqrq_prev->bounce_buf) { | 237 | kmalloc(bouncesz, GFP_KERNEL); |
238 | pr_warn("%s: unable to allocate bounce prev buffer\n", | 238 | if (!mqrq_prev->bounce_buf) { |
239 | mmc_card_name(card)); | 239 | pr_warn("%s: unable to allocate bounce prev buffer\n", |
240 | kfree(mqrq_cur->bounce_buf); | 240 | mmc_card_name(card)); |
241 | mqrq_cur->bounce_buf = NULL; | 241 | kfree(mqrq_cur->bounce_buf); |
242 | mqrq_cur->bounce_buf = NULL; | ||
243 | } | ||
242 | } | 244 | } |
243 | } | 245 | } |
244 | 246 | ||