Browse Source

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
Rakesh Pillai 5 years ago
parent
commit
e9c7f1d89b
1 changed files with 6 additions and 1 deletions
  1. 6 1
      core/dp/txrx/ol_txrx.c

+ 6 - 1
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;
 }