public inbox for linux-mmc@vger.kernel.org
 help / color / mirror / Atom feed
From: Venkatraman S <svenkatr@ti.com>
To: cjb@vger.kernel.org
Cc: linux-mmc@vger.kernel.org, linux-omap@vger.kernel.org,
	Venkatraman S <svenkatr@ti.com>,
	stable@vger.kernel.org
Subject: [PATCH 1/5] mmc: omap_hsmmc: Avoid host->cmd dereference during data transfer failures
Date: Tue, 6 Nov 2012 22:22:12 +0530	[thread overview]
Message-ID: <1352220737-14071-2-git-send-email-svenkatr@ti.com> (raw)
In-Reply-To: <1352220737-14071-1-git-send-email-svenkatr@ti.com>

Sometimes, a error occurs just after the Command has been reported
to be successful (CC=1) but before data transfer completes (TC=1).
Setting end_cmd=1 here leads to a NULL pointer dereference of
host->cmd as the command complete has previously been handled.

Set end_cmd only when command complete has not been handled
before, else a NULL pointer dereference occurs.

CC: stable@vger.kernel.org
Signed-off-by: Venkatraman S <svenkatr@ti.com>
---
 drivers/mmc/host/omap_hsmmc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 5434fd8..06d2e03 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -996,7 +996,8 @@ static void omap_hsmmc_do_irq(struct omap_hsmmc_host *host, int status)
 		else if (status & (CMD_CRC | DATA_CRC))
 			hsmmc_command_incomplete(host, -EILSEQ);
 
-		end_cmd = 1;
+		if (host->cmd)
+			end_cmd = 1;
 		if (host->data || host->response_busy) {
 			end_trans = 1;
 			host->response_busy = 0;
-- 
1.8.0


  reply	other threads:[~2012-11-06 16:52 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-06 16:52 [PATCH 0/5] mmc: omap_hsmmc: Few patches for omap_hsmmc Venkatraman S
2012-11-06 16:52 ` Venkatraman S [this message]
2012-11-09 15:48   ` [PATCH 1/5] mmc: omap_hsmmc: Avoid host->cmd dereference during data transfer failures Balaji T K
2012-11-06 16:52 ` [PATCH 2/5] mmc: omap_hsmmc: Enable HSPE bit for high speed cards Venkatraman S
2012-11-06 16:52 ` [PATCH 3/5] mmc: omap_hsmmc: introduce omap_hsmmc_prepare/complete Venkatraman S
2012-11-06 16:52 ` [PATCH 4/5] mmc: omap_hsmmc: cleanup the bitmap definitions of Interrupt Register Venkatraman S
2012-11-07 13:24   ` Balaji T K
2012-11-08  8:57     ` Venkatraman S
2012-11-06 16:52 ` [PATCH 5/5] mmc: omap_hsmmc: convert critical failure reports to dev_err Venkatraman S
2012-11-18  1:09 ` [PATCH 0/5] mmc: omap_hsmmc: Few patches for omap_hsmmc Chris Ball
2012-11-19 16:27   ` Venkatraman S

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=1352220737-14071-2-git-send-email-svenkatr@ti.com \
    --to=svenkatr@ti.com \
    --cc=cjb@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=stable@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox