From ef45abaa6e71ca62275ea52d97ef70ed90389e4f Mon Sep 17 00:00:00 2001 From: Manjunathappa Prakash Date: Fri, 29 Apr 2016 11:09:15 -0700 Subject: [PATCH] qcacld-3.0: Fix lro dereg crash on driver unload If lro_disable is called after cds_close, which is the case for module unloads, then many of the pointers used in dereg sequence are NULL (CE_state, hif, txrx_pdev). There is a case, when interfaces are removed, when these pointers are there. Check pointers before using them in dereg code. Update hif_map_service_to_pipe so that it will return E_INVAL if the service is not in the table. Add logs for cases where either leg information is not updated on return. Acked-by: Orhan K AKYILDIZ Change-Id: I5b88a297134dcc1d7a6a68dd2a9879dfd1553a7e CRs-Fixed: 1014428 --- core/dp/txrx/ol_txrx.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/core/dp/txrx/ol_txrx.c b/core/dp/txrx/ol_txrx.c index 0d1e22e60021..b374ee65a6f0 100644 --- a/core/dp/txrx/ol_txrx.c +++ b/core/dp/txrx/ol_txrx.c @@ -3919,8 +3919,11 @@ void ol_register_lro_flush_cb(void (handler)(void *), void *data) (struct hif_opaque_softc *)cds_get_context(QDF_MODULE_ID_HIF); struct ol_txrx_pdev_t *pdev = cds_get_context(QDF_MODULE_ID_TXRX); - pdev->lro_info.lro_flush_cb = handler; - pdev->lro_info.lro_data = data; + if (pdev != NULL) { + pdev->lro_info.lro_flush_cb = handler; + pdev->lro_info.lro_data = data; + } else + TXRX_PRINT(TXRX_PRINT_LEVEL_ERR, "%s: pdev NULL!", __func__); hif_lro_flush_cb_register(hif_device, ol_txrx_lro_flush, pdev); } @@ -3942,8 +3945,11 @@ void ol_deregister_lro_flush_cb(void) hif_lro_flush_cb_deregister(hif_device); - pdev->lro_info.lro_flush_cb = NULL; - pdev->lro_info.lro_data = NULL; + if (pdev != NULL) { + pdev->lro_info.lro_flush_cb = NULL; + pdev->lro_info.lro_data = NULL; + } else + TXRX_PRINT(TXRX_PRINT_LEVEL_ERR, "%s: pdev NULL!", __func__); } #endif /* FEATURE_LRO */