DHD: 4398 - Fix KP during dhd_prot_reset when htput flowring buf malloc fails during init

KP reported by customer due to failure of malloc for htput ring buf:
[   17.088063][ T1093] [09:40:43.728565][dhd][wlan]dhd_dma_buf_alloc: buf_len 327680, no memory available
[   17.088070][ T1093] [09:40:43.728572][dhd][wlan]dhd_prot_allocate_bufs: dhd_prot_ring_attach D2H Rx Completion failed
[   17.088091][ T1093] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000030
...
[   17.089190][ T1093]  dhd_prot_reset+0x61c/0x8e0 [bcmdhd4398]
[   17.089399][ T1093]  dhd_prot_detach+0x34/0xcd4 [bcmdhd4398]
[   17.089607][ T1093]  dhd_prot_attach+0x690/0xc74 [bcmdhd4398]
[   17.089812][ T1093]  dhd_attach+0x5b4/0x1f6c [bcmdhd4398]
[   17.090020][ T1093]  dhdpcie_bus_attach+0x18c/0x868 [bcmdhd4398]
[   17.090225][ T1093]  dhdpcie_pci_probe+0x89c/0x107c [bcmdhd4398]

Fixed by adding null checks in prot detach and reset path


Bug: 299597777
Test: Simulated the problem on hikey by making
'prot->prealloc_htput_flowring_buf = NULL;' during dhd_prot_attach().
KP is seen without fix in both dhd_prot_reset and dhd_prot_detach paths.
KP not seen with fix.

Change-Id: I98e30a18719323ec73d3a5a4597f2f9049e0b545
Signed-off-by: Yadukishore Kodicherla <yadukishore.kodicherla@broadcom.corp-partner.google.com>
1 file changed
tree: cc60bec9f467235e8c5e92194cca644934145973
  1. include/
  2. aiutils.c
  3. bcm_app_utils.c
  4. bcm_l2_filter.c
  5. bcmbloom.c
  6. bcmcapext.c
  7. bcmevent.c
  8. bcmsdh.c
  9. bcmsdh_linux.c
  10. bcmsdh_sdmmc.c
  11. bcmsdh_sdmmc_linux.c
  12. bcmsdspi.h
  13. bcmsdspi_linux.c
  14. bcmsdstd.h
  15. bcmspibrcm.c
  16. bcmstdlib_s.c
  17. bcmutils.c
  18. bcmwifi_channels.c
  19. bcmxtlv.c
  20. BUILD.bazel
  21. copyrights.json
  22. dhd.h
  23. dhd_bitpack.h
  24. dhd_bus.h
  25. dhd_buzzz.h
  26. dhd_cdc.c
  27. dhd_cfg80211.c
  28. dhd_cfg80211.h
  29. dhd_cfg_dscp_policy.c
  30. dhd_cfg_dscp_policy.h
  31. dhd_cfg_dscp_policy_api.h
  32. dhd_common.c
  33. dhd_custom_cis.c
  34. dhd_custom_google.c
  35. dhd_custom_gpio.c
  36. dhd_custom_memprealloc.c
  37. dhd_custom_msm.c
  38. dhd_dbg.h
  39. dhd_dbg_ring.c
  40. dhd_dbg_ring.h
  41. dhd_debug.c
  42. dhd_debug.h
  43. dhd_debug_linux.c
  44. dhd_event_log_filter.c
  45. dhd_event_log_filter.h
  46. dhd_flowring.c
  47. dhd_flowring.h
  48. dhd_ip.c
  49. dhd_ip.h
  50. dhd_linux.c
  51. dhd_linux.h
  52. dhd_linux_exportfs.c
  53. dhd_linux_lb.c
  54. dhd_linux_pktdump.c
  55. dhd_linux_pktdump.h
  56. dhd_linux_platdev.c
  57. dhd_linux_priv.h
  58. dhd_linux_rx.c
  59. dhd_linux_sched.c
  60. dhd_linux_sock_qos.h
  61. dhd_linux_tx.c
  62. dhd_linux_tx.h
  63. dhd_linux_wq.c
  64. dhd_linux_wq.h
  65. dhd_log_dump.c
  66. dhd_log_dump.h
  67. dhd_logger.h
  68. dhd_mschdbg.c
  69. dhd_mschdbg.h
  70. dhd_msgbuf.c
  71. dhd_pcie.c
  72. dhd_pcie.h
  73. dhd_pcie_linux.c
  74. dhd_pktlog.c
  75. dhd_pktlog.h
  76. dhd_plat.h
  77. dhd_pno.c
  78. dhd_pno.h
  79. dhd_proto.h
  80. dhd_rtt.c
  81. dhd_rtt.h
  82. dhd_sdio.c
  83. dhd_statlog.c
  84. dhd_statlog.h
  85. dhd_wlfc.c
  86. dhd_wlfc.h
  87. frag.c
  88. fwpkg_utils.c
  89. hal_nci_cmn.c
  90. hnd_pktpool.c
  91. hnd_pktq.c
  92. hndpmu_dhd.c
  93. hndpmu_priv.h
  94. Kbuild
  95. Kconfig
  96. linux_osl.c
  97. linux_osl_priv.h
  98. linux_pkt.c
  99. linuxerrmap.c
  100. Makefile
  101. mogboot.mk
  102. nciutils.c
  103. nciutils_host.c
  104. pcie_core_host.c
  105. siutils.c
  106. siutils_host.c
  107. siutils_priv.h
  108. verhoeff_chksum.c
  109. wb_regon_coordinator.c
  110. wb_regon_coordinator.h
  111. wifi_stats.h
  112. wl_android.c
  113. wl_android.h
  114. wl_cfg80211.c
  115. wl_cfg80211.h
  116. wl_cfg_btcoex.c
  117. wl_cfg_cellavoid.c
  118. wl_cfg_cellavoid.h
  119. wl_cfgnan.c
  120. wl_cfgnan.h
  121. wl_cfgp2p.c
  122. wl_cfgp2p.h
  123. wl_cfgscan.c
  124. wl_cfgscan.h
  125. wl_cfgvendor.c
  126. wl_cfgvendor.h
  127. wl_cfgvif.c
  128. wl_cfgvif.h
  129. wl_linux_mon.c
  130. wl_roam.c
  131. wldev_common.c