Skip to contentSkip to conversation

mmc: atmel-mci: fix oops in atmci_tasklet_func

PATCH New ludovic.desroches at atmel.com 2 participants 2 messages Sep 9, 2013 – Sep 10, 2013

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mmc: atmel-mci: fix oops in atmci_tasklet_func

From: Rodolfo Giometti <[email protected]>

In some cases, a NULL pointer dereference happens because data is NULL when STATE_END_REQUEST case is reached in atmci_tasklet_func.

---
 drivers/mmc/host/atmel-mci.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)
drivers/mmc/host/atmel-mci.c +8 -6
index e9ea2fc..78d7e47 100644
@@ -1792,12 +1792,14 @@ static void atmci_tasklet_func(unsigned long priv)
 			if (unlikely(status)) {
 				host->stop_transfer(host);
 				host->data = NULL;
-				if (status & ATMCI_DTOE) {
-					data->error = -ETIMEDOUT;
-				} else if (status & ATMCI_DCRCE) {
-					data->error = -EILSEQ;
-				} else {
-					data->error = -EIO;
+				if (data) {
+					if (status & ATMCI_DTOE) {
+						data->error = -ETIMEDOUT;
+					} else if (status & ATMCI_DCRCE) {
+						data->error = -EILSEQ;
+					} else {
+						data->error = -EIO;
+					}
 				}
 			}
 
Signature · 1 line
1.7.11.3
#1 lore raw

PATCH 1/1 mmc: atmel-mci: fix oops in atmci_tasklet_func

On 09/09/2013 17:31, ludovic.desroches at atmel.com :

Quoted 8 lines

From: Rodolfo Giometti <[email protected]>

In some cases, a NULL pointer dereference happens because data is NULL when STATE_END_REQUEST case is reached in atmci_tasklet_func.

Thanks, bye.

Quoted 30 lines
---
  drivers/mmc/host/atmel-mci.c | 14 ++++++++------
  1 file changed, 8 insertions(+), 6 deletions(-)
drivers/mmc/host/atmel-mci.c +8 -6
index e9ea2fc..78d7e47 100644
@@ -1792,12 +1792,14 @@ static void atmci_tasklet_func(unsigned long priv)
  			if (unlikely(status)) {
  				host->stop_transfer(host);
  				host->data = NULL;
-				if (status & ATMCI_DTOE) {
-					data->error = -ETIMEDOUT;
-				} else if (status & ATMCI_DCRCE) {
-					data->error = -EILSEQ;
-				} else {
-					data->error = -EIO;
+				if (data) {
+					if (status & ATMCI_DTOE) {
+						data->error = -ETIMEDOUT;
+					} else if (status & ATMCI_DCRCE) {
+						data->error = -EILSEQ;
+					} else {
+						data->error = -EIO;
+					}
  				}
  			}
 
Signature · 1 line
Nicolas Ferre