qcacld-3.0: Fix vdev ref leak in __iw_set_pno

In __iw_set_pno if memory allocation for data fails the vdev ref is
not released. Also the osif code uses WLAN_LEGACY_MAC_ID instead of
WLAN_OSIF_ID to take the vdev ref.

Fix the vdev ref leak and use WLAN_OSIF_ID to take vdev ref in
__iw_set_pno.

Change-Id: Ibb7e10ad51e36bbbcf4238aa099e2a05818ea1c1
CRs-Fixed: 2525960
This commit is contained in:
Abhishek Singh 2019-09-13 10:38:34 +05:30 • committed by nshrivas
commit 3755cdd182

View file

@ -9271,7 +9271,7 @@ static int __iw_set_pno(struct net_device *dev,
vdev = wlan_objmgr_get_vdev_by_macaddr_from_pdev(hdd_ctx->pdev,
dev->dev_addr,
WLAN_LEGACY_MAC_ID);
WLAN_OSIF_ID);
if (!vdev) {
hdd_err("vdev object is NULL");
return -EIO;
@ -9282,7 +9282,8 @@ static int __iw_set_pno(struct net_device *dev,
data = qdf_mem_malloc(len);
if (!data) {
hdd_err("fail to allocate memory %zu", len);
return -EINVAL;
ret = -EINVAL;
goto exit;
}
qdf_mem_copy(data, extra, (len-1));
ptr = data;
@ -9481,7 +9482,7 @@ static int __iw_set_pno(struct net_device *dev,
}
exit:
wlan_objmgr_vdev_release_ref(vdev, WLAN_LEGACY_MAC_ID);
wlan_objmgr_vdev_release_ref(vdev, WLAN_OSIF_ID);
qdf_mem_free(data);
return ret;