X-Git-Url: http://git.openwrt.org/?a=blobdiff_plain;f=target%2Flinux%2Fbrcm2708%2Fpatches-4.19%2F950-0687-Limit-max_req_size-under-arm64-or-any-other-platform.patch;fp=target%2Flinux%2Fbrcm2708%2Fpatches-4.19%2F950-0687-Limit-max_req_size-under-arm64-or-any-other-platform.patch;h=87b4e9b58af75f4feb9bcadb7813119a63885a8c;hb=84d555aa74434392b682fd9eb0fa701c89a046d6;hp=0000000000000000000000000000000000000000;hpb=953973c2991e8640549a55df7a0574a1abac8644;p=openwrt%2Fstaging%2Fchunkeey.git diff --git a/target/linux/brcm2708/patches-4.19/950-0687-Limit-max_req_size-under-arm64-or-any-other-platform.patch b/target/linux/brcm2708/patches-4.19/950-0687-Limit-max_req_size-under-arm64-or-any-other-platform.patch new file mode 100644 index 0000000000..87b4e9b58a --- /dev/null +++ b/target/linux/brcm2708/patches-4.19/950-0687-Limit-max_req_size-under-arm64-or-any-other-platform.patch @@ -0,0 +1,33 @@ +From 7bfcb31431f06efc233e4cc4d7ab65e10a6522cd Mon Sep 17 00:00:00 2001 +From: Yaroslav Rosomakho +Date: Fri, 23 Aug 2019 11:02:22 +0200 +Subject: [PATCH] Limit max_req_size under arm64 (or any other platform + that uses swiotlb) to prevent potential buffer overflow due to bouncing. + +Signed-off-by: Yaroslav Rosomakho +--- + drivers/mmc/host/bcm2835-mmc.c | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +--- a/drivers/mmc/host/bcm2835-mmc.c ++++ b/drivers/mmc/host/bcm2835-mmc.c +@@ -38,6 +38,7 @@ + #include + #include + #include ++#include + + #include "sdhci.h" + +@@ -1374,7 +1375,10 @@ static int bcm2835_mmc_add_host(struct b + } + #endif + mmc->max_segs = 128; +- mmc->max_req_size = 524288; ++ if (swiotlb_max_segment()) ++ mmc->max_req_size = (1 << IO_TLB_SHIFT) * IO_TLB_SEGSIZE; ++ else ++ mmc->max_req_size = 524288; + mmc->max_seg_size = mmc->max_req_size; + mmc->max_blk_size = 512; + mmc->max_blk_count = 65535;