summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Johnson <jjohnson@codeaurora.org>2016-07-20 11:03:04 -0700
committerJeff Johnson <jjohnson@codeaurora.org>2016-07-21 07:59:23 -0700
commit615d4bbfffc0ed49c9173e82c27d7a5bf3cec5c8 (patch)
tree692853d3f053962da0963cd1defd67d6b6740650
parente54e2ae2472b6d4f4251b01f8b3fe6a0626df553 (diff)
qcacld-3.0: Avoid NULL dereference in hdd_init_qdf_ctx()
Currently hdd_init_qdf_ctx() calls cds_get_context() to retrieve the QDF Device context, and then writes into the context without validating the pointer. Add logic to validate the pointer before using it. Change-Id: Ib427d1348b3ff5b13689e24f69e4606f23ea767c CRs-Fixed: 1042043
-rw-r--r--core/hdd/src/wlan_hdd_driver_ops.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/core/hdd/src/wlan_hdd_driver_ops.c b/core/hdd/src/wlan_hdd_driver_ops.c
index c80913a21ed4..f6fa4d7c6c94 100644
--- a/core/hdd/src/wlan_hdd_driver_ops.c
+++ b/core/hdd/src/wlan_hdd_driver_ops.c
@@ -294,6 +294,11 @@ void hdd_init_qdf_ctx(struct device *dev, void *bdev,
{
qdf_device_t qdf_dev = cds_get_context(QDF_MODULE_ID_QDF_DEVICE);
+ if (!qdf_dev) {
+ hdd_err("Invalid QDF device");
+ return;
+ }
+
qdf_dev->dev = dev;
qdf_dev->drv_hdl = bdev;
qdf_dev->bus_type = bus_type;