diff options
author | Masafumi UTSUGI <mutsugi@allied-telesis.co.jp> | 2019-10-01 18:59:18 +0900 |
---|---|---|
committer | Christian Lamparter <chunkeey@gmail.com> | 2019-10-20 13:01:43 +0200 |
commit | f1d761f95e9664a9c11ce1b98f9e121b43c79d35 (patch) | |
tree | c79b16bb72ab9a9e9b28cfe2dfe5021a55114104 /target/linux | |
parent | f5c7fe2ff0deb20f76b4d65195434e35cbb4e08a (diff) | |
download | upstream-f1d761f95e9664a9c11ce1b98f9e121b43c79d35.tar.gz upstream-f1d761f95e9664a9c11ce1b98f9e121b43c79d35.tar.bz2 upstream-f1d761f95e9664a9c11ce1b98f9e121b43c79d35.zip |
ipq40xx: essedma: Fix dead lock
edma_read_append_stats() gets called from two places in the driver.
The first place is the kernel timer that periodically updates
the statistics, so nothing gets lost due to overflows.
The second one it's part of the userspace ethtool ioctl handler
to provide up-to-date values.
For this configuration, the use of spin_lock() is not sufficient
and as per:
<https://mirrors.edge.kernel.org/pub/linux/kernel/people/rusty/kernel-locking/c214.html>
the locking has to be upgraded to spin_lock_bh().
Signed-off-by: Masafumi UTSUGI <mutsugi@allied-telesis.co.jp>
[folded patch into 710-, rewrote message]
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
Diffstat (limited to 'target/linux')
-rw-r--r-- | target/linux/ipq40xx/patches-4.14/710-net-add-qualcomm-essedma-ethernet-driver.patch | 4 | ||||
-rw-r--r-- | target/linux/ipq40xx/patches-4.19/710-net-add-qualcomm-essedma-ethernet-driver.patch | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/target/linux/ipq40xx/patches-4.14/710-net-add-qualcomm-essedma-ethernet-driver.patch b/target/linux/ipq40xx/patches-4.14/710-net-add-qualcomm-essedma-ethernet-driver.patch index e304911f1d..1e47f2fe90 100644 --- a/target/linux/ipq40xx/patches-4.14/710-net-add-qualcomm-essedma-ethernet-driver.patch +++ b/target/linux/ipq40xx/patches-4.14/710-net-add-qualcomm-essedma-ethernet-driver.patch @@ -2775,7 +2775,7 @@ Signed-off-by: Christian Lamparter <chunkeey@gmail.com> + int i; + u32 stat; + -+ spin_lock(&edma_cinfo->stats_lock); ++ spin_lock_bh(&edma_cinfo->stats_lock); + p = (uint32_t *)&(edma_cinfo->edma_ethstats); + + for (i = 0; i < EDMA_MAX_TRANSMIT_QUEUE; i++) { @@ -2802,7 +2802,7 @@ Signed-off-by: Christian Lamparter <chunkeey@gmail.com> + p++; + } + -+ spin_unlock(&edma_cinfo->stats_lock); ++ spin_unlock_bh(&edma_cinfo->stats_lock); +} + +static void edma_statistics_timer(unsigned long data) diff --git a/target/linux/ipq40xx/patches-4.19/710-net-add-qualcomm-essedma-ethernet-driver.patch b/target/linux/ipq40xx/patches-4.19/710-net-add-qualcomm-essedma-ethernet-driver.patch index 9fe3a1a9d6..6ccf2cd480 100644 --- a/target/linux/ipq40xx/patches-4.19/710-net-add-qualcomm-essedma-ethernet-driver.patch +++ b/target/linux/ipq40xx/patches-4.19/710-net-add-qualcomm-essedma-ethernet-driver.patch @@ -2774,7 +2774,7 @@ Signed-off-by: Christian Lamparter <chunkeey@gmail.com> + int i; + u32 stat; + -+ spin_lock(&edma_cinfo->stats_lock); ++ spin_lock_bh(&edma_cinfo->stats_lock); + p = (uint32_t *)&(edma_cinfo->edma_ethstats); + + for (i = 0; i < EDMA_MAX_TRANSMIT_QUEUE; i++) { @@ -2801,7 +2801,7 @@ Signed-off-by: Christian Lamparter <chunkeey@gmail.com> + p++; + } + -+ spin_unlock(&edma_cinfo->stats_lock); ++ spin_unlock_bh(&edma_cinfo->stats_lock); +} + +static void edma_statistics_timer(struct timer_list *t) |