[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200830082042.17462-1-baijiaju@tsinghua.edu.cn>
Date: Sun, 30 Aug 2020 16:20:42 +0800
From: Jia-Ju Bai <baijiaju@...nghua.edu.cn>
To: mchehab@...nel.org, sean@...s.org, pavel@....cz
Cc: linux-media@...r.kernel.org, linux-kernel@...r.kernel.org,
Jia-Ju Bai <baijiaju@...nghua.edu.cn>
Subject: [PATCH] media: pci: ttpci: av7110: avoid compiler optimization of reading data[0] in debiirq()
In debiirq(), data_0 stores the value of data[0], but it can be dropped
by compiler optimization. Thus, data[0] is read through READ_ONCE().
Fixes: 6499a0db9b0f ("media: pci: ttpci: av7110: fix possible buffer overflow caused by bad DMA value in debiirq()")
Reported-by: Pavel Machek <pavel@....cz>
Signed-off-by: Jia-Ju Bai <baijiaju@...nghua.edu.cn>
---
drivers/media/pci/ttpci/av7110.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/media/pci/ttpci/av7110.c b/drivers/media/pci/ttpci/av7110.c
index bf36b1e22b63..f7d098d5b198 100644
--- a/drivers/media/pci/ttpci/av7110.c
+++ b/drivers/media/pci/ttpci/av7110.c
@@ -406,7 +406,7 @@ static void debiirq(unsigned long cookie)
case DATA_CI_GET:
{
u8 *data = av7110->debi_virt;
- u8 data_0 = data[0];
+ u8 data_0 = READ_ONCE(data[0]);
if (data_0 < 2 && data[2] == 0xff) {
int flags = 0;
--
2.17.1
Powered by blists - more mailing lists