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
This commit is contained in:
Rakesh Pillai 2019-11-24 13:15:56 +05:30 committed by nshrivas
parent 6fc2b727cc
commit e9c7f1d89b

View File

@ -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;
}