diff --git a/drivers/net/wireless/ath/ath10k/sdio.c b/drivers/net/wireless/ath/ath10k/sdio.c
--- a/drivers/net/wireless/ath/ath10k/sdio.c
+++ b/drivers/net/wireless/ath/ath10k/sdio.c
@@ -336,7 +336,6 @@ static int ath10k_sdio_write(struct ath10k *ar, u32 addr, const void *buf, size_

        ath10k_dbg(ar, ATH10K_DBG_SDIO, "sdio write addr 0x%x buf 0x%p len %zu\n",
                   addr, buf, len);
-       ath10k_dbg_dump(ar, ATH10K_DBG_SDIO_DUMP, NULL, "sdio write ", buf, len);

 out:
        sdio_release_host(func);
@@ -692,6 +691,8 @@ static int ath10k_sdio_mbox_rx_fetch_bundle(struct ath10k *ar)
                goto err;
        }

+       ath10k_dbg_dump(ar, ATH10K_DBG_SDIO_DUMP, NULL, "sdio read vsg", ar_sdio->vsg_buffer, virt_pkt_len);
+
        pkt_offset = 0;
        for (i = 0; i < ar_sdio->n_rx_pkts; i++) {
                pkt = &ar_sdio->rx_pkts[i];

dmesg of try:
[  170.621318] Unable to handle kernel paging request at virtual address 0036353433323138
[  170.621336] Mem abort info:
[  170.621341]   ESR = 0x96000004
[  170.621347]   Exception class = DABT (current EL), IL = 32 bits
[  170.621352]   SET = 0, FnV = 0
[  170.621357]   EA = 0, S1PTW = 0
[  170.621362] Data abort info:
[  170.621367]   ISV = 0, ISS = 0x00000004
[  170.621371]   CM = 0, WnR = 0
[  170.621377] [0036353433323138] address between user and kernel address ranges
[  170.621385] Internal error: Oops: 96000004 [#1] PREEMPT SMP
[  170.621479] Process kworker/0:1 (pid: 14, stack limit = 0x00000000c6fcfb2a)
[  170.621489] CPU: 0 PID: 14 Comm: kworker/0:1 Not tainted 4.19.139 #162
[  170.621494] Hardware name: MediaTek krane sku176 board (DT)
[  170.621511] Workqueue: events sdio_irq_work
[  170.621519] pstate: 80000005 (Nzcv daif -PAN -UAO)
[  170.621529] pc : filter_match_preds+0x20/0x94
[  170.621540] lr : trace_event_buffer_commit+0x150/0x22c
[  170.621545] sp : ffffff80080f37d0
[  170.621550] x29: ffffff80080f3800 x28: 000000000000000c
[  170.621556] x27: 000000000000000c x26: 0000000000000001
[  170.621563] x25: fffffff118eb8008 x24: 0000000000000000
[  170.621569] x23: 0000000000000000 x22: fffffff17b007900
[  170.621576] x21: fffffff118eb8000 x20: 3736353433323130
[  170.621583] x19: fffffff178645790 x18: 0000000000000020
[  170.621589] x17: 000000000000003c x16: ffffff91fe3937f0
[  170.621596] x15: 0000000000000006 x14: 00000636000ad8b0
[  170.621602] x13: 0000000000000000 x12: 0000000000000000
[  170.621608] x11: 0000000000000000 x10: 0000000000000000
[  170.621615] x9 : 0000000000000000 x8 : 000000000000040b
[  170.621621] x7 : 0000000000000000 x6 : fffffff118ec6052
[  170.621628] x5 : 0000000000000000 x4 : 0000000000000000
[  170.621634] x3 : 000000000000e04e x2 : ffffffffffffffc0
[  170.621640] x1 : fffffff118eb8008 x0 : fffffff118ec1f00
[  170.621648] Call trace:
[  170.621655]  filter_match_preds+0x20/0x94
[  170.621662]  trace_event_buffer_commit+0x150/0x22c
[  170.621704]  trace_event_raw_event_ath10k_log_dbg_dump+0x208/0x240 [ath10k_core]
[  170.621724]  ath10k_dbg_dump+0x1bc/0x21c [ath10k_core]
[  170.621734]  ath10k_sdio_readsb+0xdc/0xfc [ath10k_sdio]
[  170.621742]  ath10k_sdio_irq_handler+0x6f8/0xca8 [ath10k_sdio]
[  170.621749]  process_sdio_pending_irqs+0x60/0x1b4
[  170.621756]  sdio_run_irqs+0x34/0x60
[  170.621762]  sdio_irq_work+0x1c/0x28
[  170.621769]  process_one_work+0x210/0x418
[  170.621775]  worker_thread+0x234/0x3dc
[  170.621783]  kthread+0x120/0x140
[  170.621791]  ret_from_fork+0x10/0x18
[  170.621799] Code: 9100c3fd b40002e0 f9400014 b40002b4 (f9400680)
[  170.621807] ---[ end trace b52c34b9c8deb8e3 ]---
[  170.624123] Unable to handle kernel paging request at virtual address dffd74685cec003c
[  170.624134] Mem abort info:
[  170.624138]   ESR = 0x96000004
[  170.624143]   Exception class = DABT (current EL), IL = 32 bits
[  170.624146]   SET = 0, FnV = 0
[  170.624150]   EA = 0, S1PTW = 0
[  170.624153] Data abort info:
[  170.624157]   ISV = 0, ISS = 0x00000004
[  170.624160]   CM = 0, WnR = 0
[  170.624165] [dffd74685cec003c] address between user and kernel address ranges
[  170.634352] Kernel panic - not syncing: Fatal exception
[  170.634370] SMP: stopping secondary CPUs
[  171.711302] SMP: failed to stop secondary CPUs 0,4
[  171.711310] Kernel Offset: 0x11f6200000 from 0xffffff8008000000
[  171.711316] CPU features: 0x0,2188200c
[  171.711321] Memory Limit: none
[  171.723885] SMP: stopping secondary CPUs
[  172.800814] SMP: failed to stop secondary CPUs 0,4

trace_event_raw_event_ath10k_log_dbg_dump is generated by compiler, it
call trace_event_buffer_reserve got get a struct pointer *entry, its
type is trace_event_raw_ath10k_log_dbg_dump which is also generated by
compiler, trace_event_buffer_reserve of kernel/trace/trace_events.c
call trace_event_buffer_lock_reserve to get ring_buffer_event.

In function trace_event_buffer_lock_reserve of kernel/trace/trace.c,
the ring_buffer_time_stamp_abs is false and trace_file->flags is 0x40b
which is set bit of EVENT_FILE_FL_FILTERED by debugging, so it use the
temp buffer this_cpu_read(trace_buffered_event), and the buffer size
is 1 page size which allocatee in trace_buffered_event_enable by
alloc_pages_node, and then ath10k pass the buffer size > 1 page trigger
overflow and crash.

Based on upper test, try and debugging, pass large buff size to function
trace_ath10k_log_dbg_dump cause crash, and it has ath10k_dbg in
ath10k_sdio_write to print the length of skb/buffer, it is not necessary
to trace all content of the large skb.

Tested-on: QCA6174 hw3.2 SDIO WLAN.RMH.4.4.1-00049

Signed-off-by: Wen Gong <wgong@codeaurora.org>
---
 drivers/net/wireless/ath/ath10k/debug.c | 2 +-
 drivers/net/wireless/ath/ath10k/debug.h | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath10k/debug.c b/drivers/net/wireless/ath/ath10k/debug.c
index e8250a665433..5433dbdde0e5 100644
--- a/drivers/net/wireless/ath/ath10k/debug.c
+++ b/drivers/net/wireless/ath/ath10k/debug.c
@@ -2718,7 +2718,7 @@ void ath10k_dbg_dump(struct ath10k *ar,
 
 	/* tracing code doesn't like null strings :/ */
 	trace_ath10k_log_dbg_dump(ar, msg ? msg : "", prefix ? prefix : "",
-				  buf, len);
+				  buf, min_t(size_t, len, ATH10K_LOG_DUMP_MAX));
 }
 EXPORT_SYMBOL(ath10k_dbg_dump);
 
diff --git a/drivers/net/wireless/ath/ath10k/debug.h b/drivers/net/wireless/ath/ath10k/debug.h
index 997c1c80aba7..cec9ba92f28f 100644
--- a/drivers/net/wireless/ath/ath10k/debug.h
+++ b/drivers/net/wireless/ath/ath10k/debug.h
@@ -11,6 +11,8 @@
 #include <linux/types.h>
 #include "trace.h"
 
+#define ATH10K_LOG_DUMP_MAX 1024
+
 enum ath10k_debug_mask {
 	ATH10K_DBG_PCI		= 0x00000001,
 	ATH10K_DBG_WMI		= 0x00000002,
