openwrtv3/target/linux/mediatek/patches-4.9/0063-atomic-sleep.patch
Kevin Darbyshire-Bryant 886d66abcd kernel: bump 4.9 to 4.9.57
Refresh patches.
Compile-tested for ar71xx - Archer C7 v2
Runtime-tested on  ar71xx - Archer C7 v2

Fixes the following CVEs:

- CVE-2017-7518
- CVE-2017-0786
- CVE-2017-1000255
- CVE-2017-12188
- CVE-2017-15265

Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
2017-10-18 19:44:09 +03:00

38 lines
972 B
Diff

--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
@@ -1533,7 +1533,10 @@ static void mtk_hwlro_rx_uninit(struct m
for (i = 0; i < 10; i++) {
val = mtk_r32(eth, MTK_PDMA_LRO_CTRL_DW0);
if (val & MTK_LRO_RING_RELINQUISH_DONE) {
- msleep(20);
+ if (in_atomic())
+ mdelay(20);
+ else
+ msleep(20);
continue;
}
break;
@@ -1951,7 +1954,10 @@ static void mtk_stop_dma(struct mtk_eth
for (i = 0; i < 10; i++) {
val = mtk_r32(eth, glo_cfg);
if (val & (MTK_TX_DMA_BUSY | MTK_RX_DMA_BUSY)) {
- msleep(20);
+ if (in_atomic())
+ mdelay(20);
+ else
+ msleep(20);
continue;
}
break;
@@ -1996,7 +2002,10 @@ static void ethsys_reset(struct mtk_eth
reset_bits,
reset_bits);
- usleep_range(1000, 1100);
+ if (in_atomic())
+ udelay(1000);
+ else
+ usleep_range(1000, 1100);
regmap_update_bits(eth->ethsys, ETHSYS_RSTCTRL,
reset_bits,
~reset_bits);