All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bhuvanesh <bhuvanesh_surachari@mentor.com>
To: Ulf Hansson <ulf.hansson@linaro.org>
Cc: Chris Ball <chris@printf.net>, Mike Snitzer <snitzer@redhat.com>,
	Jens Axboe <axboe@fb.com>,
	Russell King <rmk+kernel@arm.linux.org.uk>,
	Joe Perches <joe@perches.com>,
	harish_kandiga@mentor.com, linux-mmc <linux-mmc@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [Patch] Improve error handling in allocation of bounce buffers in mmc_init_queue
Date: Wed, 3 Dec 2014 11:53:10 +0530	[thread overview]
Message-ID: <547EAC4E.1090902@mentor.com> (raw)
In-Reply-To: <CAPDyKFpOio0soa6OnmAv2AKDJ65WOdFhrRrKQuzek=JstUzX-Q@mail.gmail.com>

Hi,
  
  Thanks for guiding. I read through Documentation/SubmittingPatches.
Fixed the warnings given by checkpatch. Kindly review the updated patch.

>From 7ea020e32e1fbe4d05d104e31815d908af92f2a5 Mon Sep 17 00:00:00 2001
From: Bhuvanesh Surachari <bhuvanesh_surachari@mentor.com>
Date: Mon, 1 Dec 2014 02:23:02 -0500
Subject: [PATCH] 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>
---
 drivers/mmc/card/queue.c |   16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/drivers/mmc/card/queue.c b/drivers/mmc/card/queue.c
index cfa6110..236d194 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,
 			if (!mqrq_cur->bounce_buf) {
 				pr_warn("%s: unable to allocate bounce cur buffer\n",
 					mmc_card_name(card));
-			}
-			mqrq_prev->bounce_buf = kmalloc(bouncesz, GFP_KERNEL);
-			if (!mqrq_prev->bounce_buf) {
-				pr_warn("%s: unable to allocate bounce prev buffer\n",
-					mmc_card_name(card));
-				kfree(mqrq_cur->bounce_buf);
-				mqrq_cur->bounce_buf = NULL;
+			} else {
+				mqrq_prev->bounce_buf =
+						kmalloc(bouncesz, GFP_KERNEL);
+				if (!mqrq_prev->bounce_buf) {
+					pr_warn("%s: unable to allocate bounce prev buffer\n",
+						mmc_card_name(card));
+					kfree(mqrq_cur->bounce_buf);
+					mqrq_cur->bounce_buf = NULL;
+				}
 			}
 		}
 
-- 
1.7.9.5



Thank you,
Regards,
Bhuvanesh

On 12/02/2014 05:01 PM, Ulf Hansson wrote:
> On 1 December 2014 at 12:56, Bhuvanesh <bhuvanesh_surachari@mentor.com> wrote:
>> Hi,
>>
>>   Please find the patch inline.
> 
> Apparently you didn't read /Documentation/SubmittingPatches.
> 
> If you want me to review, please follow that guide. For example, I
> expect you to run checkpatch.
> 
> Kind regards
> Uffe
> 

WARNING: multiple messages have this Message-ID (diff)
From: Bhuvanesh <bhuvanesh_surachari@mentor.com>
To: Ulf Hansson <ulf.hansson@linaro.org>
Cc: Chris Ball <chris@printf.net>, Mike Snitzer <snitzer@redhat.com>,
	Jens Axboe <axboe@fb.com>,
	Russell King <rmk+kernel@arm.linux.org.uk>,
	Joe Perches <joe@perches.com>, <harish_kandiga@mentor.com>,
	linux-mmc <linux-mmc@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [Patch] Improve error handling in allocation of bounce buffers in mmc_init_queue
Date: Wed, 3 Dec 2014 11:53:10 +0530	[thread overview]
Message-ID: <547EAC4E.1090902@mentor.com> (raw)
In-Reply-To: <CAPDyKFpOio0soa6OnmAv2AKDJ65WOdFhrRrKQuzek=JstUzX-Q@mail.gmail.com>

Hi,
  
  Thanks for guiding. I read through Documentation/SubmittingPatches.
Fixed the warnings given by checkpatch. Kindly review the updated patch.

>From 7ea020e32e1fbe4d05d104e31815d908af92f2a5 Mon Sep 17 00:00:00 2001
From: Bhuvanesh Surachari <bhuvanesh_surachari@mentor.com>
Date: Mon, 1 Dec 2014 02:23:02 -0500
Subject: [PATCH] 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>
---
 drivers/mmc/card/queue.c |   16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/drivers/mmc/card/queue.c b/drivers/mmc/card/queue.c
index cfa6110..236d194 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,
 			if (!mqrq_cur->bounce_buf) {
 				pr_warn("%s: unable to allocate bounce cur buffer\n",
 					mmc_card_name(card));
-			}
-			mqrq_prev->bounce_buf = kmalloc(bouncesz, GFP_KERNEL);
-			if (!mqrq_prev->bounce_buf) {
-				pr_warn("%s: unable to allocate bounce prev buffer\n",
-					mmc_card_name(card));
-				kfree(mqrq_cur->bounce_buf);
-				mqrq_cur->bounce_buf = NULL;
+			} else {
+				mqrq_prev->bounce_buf =
+						kmalloc(bouncesz, GFP_KERNEL);
+				if (!mqrq_prev->bounce_buf) {
+					pr_warn("%s: unable to allocate bounce prev buffer\n",
+						mmc_card_name(card));
+					kfree(mqrq_cur->bounce_buf);
+					mqrq_cur->bounce_buf = NULL;
+				}
 			}
 		}
 
-- 
1.7.9.5



Thank you,
Regards,
Bhuvanesh

On 12/02/2014 05:01 PM, Ulf Hansson wrote:
> On 1 December 2014 at 12:56, Bhuvanesh <bhuvanesh_surachari@mentor.com> wrote:
>> Hi,
>>
>>   Please find the patch inline.
> 
> Apparently you didn't read /Documentation/SubmittingPatches.
> 
> If you want me to review, please follow that guide. For example, I
> expect you to run checkpatch.
> 
> Kind regards
> Uffe
> 

  reply	other threads:[~2014-12-03  6:23 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-01 10:24 [Patch] Improve error handling in allocation of bounce buffers in mmc_init_queue Bhuvanesh
2014-12-01 10:24 ` Bhuvanesh
2014-12-01 10:41 ` Ulf Hansson
2014-12-01 10:41   ` Ulf Hansson
2014-12-01 11:56   ` Bhuvanesh
2014-12-01 11:56     ` Bhuvanesh
2014-12-02 11:31     ` Ulf Hansson
2014-12-03  6:23       ` Bhuvanesh [this message]
2014-12-03  6:23         ` Bhuvanesh
2014-12-03  9:49         ` Ulf Hansson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=547EAC4E.1090902@mentor.com \
    --to=bhuvanesh_surachari@mentor.com \
    --cc=axboe@fb.com \
    --cc=chris@printf.net \
    --cc=harish_kandiga@mentor.com \
    --cc=joe@perches.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=rmk+kernel@arm.linux.org.uk \
    --cc=snitzer@redhat.com \
    --cc=ulf.hansson@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.