linux/drivers/atm
Gui-Dong Han 82fca3d8a4 atm/fore200e: Fix possible data race in fore200e_open()
Protect access to fore200e->available_cell_rate with rate_mtx lock in the
error handling path of fore200e_open() to prevent a data race.

The field fore200e->available_cell_rate is a shared resource used to track
available bandwidth. It is concurrently accessed by fore200e_open(),
fore200e_close(), and fore200e_change_qos().

In fore200e_open(), the lock rate_mtx is correctly held when subtracting
vcc->qos.txtp.max_pcr from available_cell_rate to reserve bandwidth.
However, if the subsequent call to fore200e_activate_vcin() fails, the
function restores the reserved bandwidth by adding back to
available_cell_rate without holding the lock.

This introduces a race condition because available_cell_rate is a global
device resource shared across all VCCs. If the error path in
fore200e_open() executes concurrently with operations like
fore200e_close() or fore200e_change_qos() on other VCCs, a
read-modify-write race occurs.

Specifically, the error path reads the rate without the lock. If another
CPU acquires the lock and modifies the rate (e.g., releasing bandwidth in
fore200e_close()) between this read and the subsequent write, the error
path will overwrite the concurrent update with a stale value. This results
in incorrect bandwidth accounting.

Fixes: 1da177e4c3 ("Linux-2.6.12-rc2")
Cc: stable@vger.kernel.org
Signed-off-by: Gui-Dong Han <hanguidong02@gmail.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20251120120657.2462194-1-hanguidong02@gmail.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
2025-11-25 12:39:26 +01:00
..
.gitignore
Kconfig net: atm: remove support for ZeitNet ZN122x ATM devices 2022-04-27 12:22:56 +01:00
Makefile net: atm: remove support for ZeitNet ZN122x ATM devices 2022-04-27 12:22:56 +01:00
adummy.c
atmtcp.c atm: atmtcp: Prevent arbitrary write in atmtcp_recv_control(). 2025-08-22 17:23:15 -07:00
eni.c net: fill in MODULE_DESCRIPTION()s for ATM 2024-01-05 08:04:23 -08:00
eni.h
fore200e.c atm/fore200e: Fix possible data race in fore200e_open() 2025-11-25 12:39:26 +01:00
fore200e.h atm/fore200e: Delete unused 'fore200e_boards' 2024-05-06 18:26:47 -07:00
he.c atm: he: Use the bitmap API to allocate bitmaps 2022-07-11 19:49:53 -07:00
he.h
idt77105.c treewide: Switch/rename to timer_delete[_sync]() 2025-04-05 10:30:12 +02:00
idt77105.h
idt77252.c atm: idt77252: Add missing `dma_map_error()` 2025-06-25 15:28:57 -07:00
idt77252.h
idt77252_tables.h
iphase.c treewide: Switch/rename to timer_delete[_sync]() 2025-04-05 10:30:12 +02:00
iphase.h
lanai.c atm: lanai: fix "take a while" typo 2025-07-08 08:27:19 -07:00
midway.h
nicstar.c treewide: Switch/rename to timer_delete[_sync]() 2025-04-05 10:30:12 +02:00
nicstar.h
nicstarmac.c
nicstarmac.copyright
solos-attrlist.c
solos-pci.c atm: solos-pci: Fix potential deadlock on &tx_queue_lock 2023-12-09 21:17:45 +00:00
suni.c treewide: Switch/rename to timer_delete[_sync]() 2025-04-05 10:30:12 +02:00
suni.h
tonga.h
zeprom.h