linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mmc: atmel-mci: fix oops in atmci_tasklet_func
@ 2013-09-09 15:31 ludovic.desroches at atmel.com
  2013-09-10  8:04 ` Nicolas Ferre
  0 siblings, 1 reply; 2+ messages in thread
From: ludovic.desroches at atmel.com @ 2013-09-09 15:31 UTC (permalink / raw)
  To: linux-arm-kernel

From: Rodolfo Giometti <giometti@enneenne.com>

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

Cc: <stable@vger.kernel.org> #3.9+
Signed-off-by: Rodolfo Giometti <giometti@enneenne.com>
Acked-by: Ludovic Desroches <ludovic.desroches@atmel.com>
---
 drivers/mmc/host/atmel-mci.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c
index e9ea2fc..78d7e47 100644
--- a/drivers/mmc/host/atmel-mci.c
+++ b/drivers/mmc/host/atmel-mci.c
@@ -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;
+					}
 				}
 			}
 
-- 
1.7.11.3

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [PATCH] mmc: atmel-mci: fix oops in atmci_tasklet_func
  2013-09-09 15:31 [PATCH] mmc: atmel-mci: fix oops in atmci_tasklet_func ludovic.desroches at atmel.com
@ 2013-09-10  8:04 ` Nicolas Ferre
  0 siblings, 0 replies; 2+ messages in thread
From: Nicolas Ferre @ 2013-09-10  8:04 UTC (permalink / raw)
  To: linux-arm-kernel

On 09/09/2013 17:31, ludovic.desroches at atmel.com :
> From: Rodolfo Giometti <giometti@enneenne.com>
>
> In some cases, a NULL pointer dereference happens because data is NULL when
> STATE_END_REQUEST case is reached in atmci_tasklet_func.
>
> Cc: <stable@vger.kernel.org> #3.9+
> Signed-off-by: Rodolfo Giometti <giometti@enneenne.com>
> Acked-by: Ludovic Desroches <ludovic.desroches@atmel.com>

Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>

Thanks, bye.

> ---
>   drivers/mmc/host/atmel-mci.c | 14 ++++++++------
>   1 file changed, 8 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c
> index e9ea2fc..78d7e47 100644
> --- a/drivers/mmc/host/atmel-mci.c
> +++ b/drivers/mmc/host/atmel-mci.c
> @@ -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;
> +					}
>   				}
>   			}
>
>


-- 
Nicolas Ferre

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-09-10  8:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-09 15:31 [PATCH] mmc: atmel-mci: fix oops in atmci_tasklet_func ludovic.desroches at atmel.com
2013-09-10  8:04 ` Nicolas Ferre

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).