From e9c7f1d89b03bf35176f2d6fb5fdbc47045f1c8d Mon Sep 17 00:00:00 2001 From: Rakesh Pillai Date: Sun, 24 Nov 2019 13:15:56 +0530 Subject: [PATCH] qcacld-3.0: Check vdev handle before returning opmode The query for an interface opmode returns the opmode of a particular interface without checking if that particular virtual interface handle is valid or not. Fix this by checking the virtual interface handle before trying to get the operation mode for that particular interface. CRs-Fixed: 2572981 Change-Id: I05b5f88455d6374adb41a037d3c5dda905de1497 --- core/dp/txrx/ol_txrx.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/core/dp/txrx/ol_txrx.c b/core/dp/txrx/ol_txrx.c index 51aa11bd177c..63397e64ee7c 100644 --- a/core/dp/txrx/ol_txrx.c +++ b/core/dp/txrx/ol_txrx.c @@ -2472,13 +2472,18 @@ ol_txrx_get_pn_info(struct cdp_soc_t *soc_hdl, uint8_t *peer_mac, * @soc_hdl: Datapath soc handle * @vdev_id: id of vdev * - * Return: operation mode. + * Return: interface opmode if SUCCESS, + * 0 if interface does not exist. */ static int ol_txrx_get_opmode(struct cdp_soc_t *soc_hdl, uint8_t vdev_id) { struct ol_txrx_vdev_t *vdev; vdev = (struct ol_txrx_vdev_t *)ol_txrx_get_vdev_from_vdev_id(vdev_id); + if (!vdev) { + ol_txrx_err("vdev for id %d is NULL", vdev_id); + return 0; + } return vdev->opmode; }