qcacmn: Use atomic variant mem alloc API while in ndo_get_stats

When kernel calls driver callback to get stats, dev_get_stats()->
ndo_get_stats64() .Host driver allocates memory using
kmalloc (size, GFP_KERNEL) routine,
but as ndo_get_stats is under RCU lock but not in interrupt
context(in_irq = 0, in_interrupt = 0, irq_disable = 1),
qdf_mem_malloc () uses ‘GFP_KERNEL’ to allocate memory,
leading to backtrace.
As per kernel doc
(https://www.kernel.org/doc/Documentation/networking/statistics.rst),
while in ndo_get_stats64 () API, driver should not calling a routing
which can sleep. Use atomic variant of qdf_mem_malloc() to fix this.

Change-Id: I3585b93d227a36b4b01c9c4f72d878c6cdb44cd4
CRs-Fixed:3020603
This commit is contained in:
Amir Patel
2021-08-24 11:24:37 +05:30
committed by Madan Koyyalamudi
parent d06d841dc6
commit 437f0113c8

View File

@@ -7695,7 +7695,7 @@ void dp_aggregate_pdev_stats(struct dp_pdev *pdev)
struct dp_vdev *vdev = NULL;
struct dp_soc *soc;
struct cdp_vdev_stats *vdev_stats =
qdf_mem_malloc(sizeof(struct cdp_vdev_stats));
qdf_mem_malloc_atomic(sizeof(struct cdp_vdev_stats));
if (!vdev_stats) {
dp_cdp_err("%pK: DP alloc failure - unable to get alloc vdev stats",