[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID:
<ME3P282MB3617E02526BEE4B295478B1AC0C72@ME3P282MB3617.AUSP282.PROD.OUTLOOK.COM>
Date: Tue, 11 Jun 2024 11:54:10 +0800
From: Gui-Dong Han <hanguidong02@...look.com>
To: 3chas3@...il.com
Cc: linux-atm-general@...ts.sourceforge.net,
netdev@...r.kernel.org,
linux-kernel@...r.kernel.org,
baijiaju1990@...il.com,
Gui-Dong Han <hanguidong02@...look.com>
Subject: [PATCH] atm/fore200e: Consolidate available cell rate update to prevent race condition
In fore200e_change_qos, there is a race condition due to two consecutive
updates to the 'available_cell_rate' variable. If a read operation
occurs between these updates, an intermediate value might be read,
leading to potential bugs.
To fix this issue, 'available_cell_rate' should be adjusted in a single
operation, ensuring consistency and preventing any intermediate states
from being read.
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Gui-Dong Han <hanguidong02@...look.com>
---
drivers/atm/fore200e.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/atm/fore200e.c b/drivers/atm/fore200e.c
index cb00f8244e41..d54e044d7542 100644
--- a/drivers/atm/fore200e.c
+++ b/drivers/atm/fore200e.c
@@ -1906,8 +1906,7 @@ fore200e_change_qos(struct atm_vcc* vcc,struct atm_qos* qos, int flags)
return -EAGAIN;
}
- fore200e->available_cell_rate += vcc->qos.txtp.max_pcr;
- fore200e->available_cell_rate -= qos->txtp.max_pcr;
+ fore200e->available_cell_rate += vcc->qos.txtp.max_pcr - qos->txtp.max_pcr;
mutex_unlock(&fore200e->rate_mtx);
--
2.34.1
Powered by blists - more mailing lists