[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1392657637-5297-1-git-send-email-maxime.ripard@free-electrons.com>
Date: Mon, 17 Feb 2014 18:20:37 +0100
From: Maxime Ripard <maxime.ripard@...e-electrons.com>
To: Mark Brown <broonie@...nel.org>
Cc: linux-spi@...r.kernel.org, linux-kernel@...r.kernel.org,
kevin.z.m.zh@...il.com, sunny@...winnertech.com,
shuge@...winnertech.com, zhuzhenhua@...winnertech.com,
Maxime Ripard <maxime.ripard@...e-electrons.com>,
stable@...r.kernel.org
Subject: [PATCH] spi: core: Fix Oops in spi_pump_messages error path
When the generic implementation of the transfer_one_message callback was called
by the spi_pump_messages function, if that transfer was to fail, the
spi_finalize_current_message was called twice, once in
spi_transfer_one_message, and one in spi_pump_messages.
This was causing a null pointer dereference in the second call, because the
first one set the ->cur_msg field to NULL.
Since the SPI framework expect the transfer_one_message callback to call
spi_finalize_current_message, we can remove it from spi_pump_messages, together
with any dereference of the ->cur_msg pointer.
Signed-off-by: Maxime Ripard <maxime.ripard@...e-electrons.com>
Cc: stable@...r.kernel.org
---
drivers/spi/spi.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 23756b0..39f12be 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -756,8 +756,6 @@ static void spi_pump_messages(struct kthread_work *work)
if (ret) {
dev_err(&master->dev,
"failed to transfer one message from queue: %d\n", ret);
- master->cur_msg->status = ret;
- spi_finalize_current_message(master);
return;
}
}
--
1.8.4.2
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists