From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Dan Carpenter <dan.carpenter@oracle.com>,
Vinod Koul <vkoul@kernel.org>, Sasha Levin <sashal@kernel.org>,
dmaengine@vger.kernel.org
Subject: [PATCH AUTOSEL 5.1 10/11] dmaengine: jz4780: Fix an endian bug in IRQ handler
Date: Wed, 10 Jul 2019 11:02:37 -0400 [thread overview]
Message-ID: <20190710150240.6984-10-sashal@kernel.org> (raw)
In-Reply-To: <20190710150240.6984-1-sashal@kernel.org>
From: Dan Carpenter <dan.carpenter@oracle.com>
[ Upstream commit 4c89cc73d1da42ae48b5c5dfbfd12304d0b86786 ]
The "pending" variable was a u32 but we cast it to an unsigned long
pointer when we do the for_each_set_bit() loop. The problem is that on
big endian 64bit systems that results in an out of bounds read.
Fixes: 4e4106f5e942 ("dmaengine: jz4780: Fix transfers being ACKed too soon")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/dma/dma-jz4780.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/dma/dma-jz4780.c b/drivers/dma/dma-jz4780.c
index f49534019d37..503d9f13ea97 100644
--- a/drivers/dma/dma-jz4780.c
+++ b/drivers/dma/dma-jz4780.c
@@ -722,12 +722,13 @@ static irqreturn_t jz4780_dma_irq_handler(int irq, void *data)
{
struct jz4780_dma_dev *jzdma = data;
unsigned int nb_channels = jzdma->soc_data->nb_channels;
- uint32_t pending, dmac;
+ unsigned long pending;
+ uint32_t dmac;
int i;
pending = jz4780_dma_ctrl_readl(jzdma, JZ_DMA_REG_DIRQP);
- for_each_set_bit(i, (unsigned long *)&pending, nb_channels) {
+ for_each_set_bit(i, &pending, nb_channels) {
if (jz4780_dma_chan_irq(jzdma, &jzdma->chan[i]))
pending &= ~BIT(i);
}
--
2.20.1
next prev parent reply other threads:[~2019-07-10 15:05 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-10 15:02 [PATCH AUTOSEL 5.1 01/11] MIPS: ath79: fix ar933x uart parity mode Sasha Levin
2019-07-10 15:02 ` [PATCH AUTOSEL 5.1 02/11] MIPS: fix build on non-linux hosts Sasha Levin
2019-07-10 15:02 ` [PATCH AUTOSEL 5.1 03/11] drm/virtio: move drm_connector_update_edid_property() call Sasha Levin
2019-07-10 15:02 ` Sasha Levin
2019-07-10 15:02 ` Sasha Levin
2019-07-10 15:02 ` [PATCH AUTOSEL 5.1 04/11] arm64/efi: Mark __efistub_stext_offset as an absolute symbol explicitly Sasha Levin
2019-07-10 15:02 ` [PATCH AUTOSEL 5.1 05/11] drm/etnaviv: add missing failure path to destroy suballoc Sasha Levin
2019-07-10 15:02 ` Sasha Levin
2019-07-10 15:02 ` [PATCH AUTOSEL 5.1 06/11] KVM: x86: degrade WARN to pr_warn_ratelimited Sasha Levin
2019-07-10 15:02 ` [PATCH AUTOSEL 5.1 07/11] scsi: iscsi: set auth_protocol back to NULL if CHAP_A value is not supported Sasha Levin
2019-07-10 15:02 ` [PATCH AUTOSEL 5.1 07/11] scsi: iscsi: set auth_protocol back to NULL if CHAP_A value is not support Sasha Levin
2019-07-10 15:02 ` [PATCH AUTOSEL 5.1 08/11] drm/imx: notify drm core before sending event during crtc disable Sasha Levin
2019-07-10 15:02 ` Sasha Levin
2019-07-10 15:02 ` [PATCH AUTOSEL 5.1 09/11] drm/imx: only send event on crtc disable if kept disabled Sasha Levin
2019-07-10 15:02 ` Sasha Levin
2019-07-10 15:02 ` Sasha Levin [this message]
2019-07-10 15:02 ` [PATCH AUTOSEL 5.1 11/11] dmaengine: imx-sdma: fix use-after-free on probe error path Sasha Levin
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=20190710150240.6984-10-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=dan.carpenter@oracle.com \
--cc=dmaengine@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=stable@vger.kernel.org \
--cc=vkoul@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 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.