qcacmn: Avoid null pointer dereference and OOB access

Avoid possible null pointer dereferece and out of bound access
in NAN component.

Change-Id: I40ba4e340e34e8975c782c0a6329322e3c151326
CRs-Fixed: 2160751
这个提交包含在:
Naveen Rawat
2017-12-21 11:30:40 -08:00
提交者 snandini
父节点 489ac74236
当前提交 7b5cffe84f
修改 5 个文件,包含 116 行新增40 行删除

查看文件

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2017 The Linux Foundation. All rights reserved.
* Copyright (c) 2017-2018 The Linux Foundation. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
@@ -148,4 +148,14 @@ struct wlan_objmgr_vdev *wlan_util_get_vdev_by_ifname(
struct wlan_objmgr_psoc *psoc, char *ifname,
wlan_objmgr_ref_dbgid ref_id);
/**
* wlan_util_vdev_get_if_name() - get vdev's interface name
* @vdev: VDEV object
*
* API to get vdev's interface name
*
* Return:
* @id: vdev's interface name
*/
uint8_t *wlan_util_vdev_get_if_name(struct wlan_objmgr_vdev *vdev);
#endif /* _WLAN_UTILITY_H_ */

查看文件

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2017 The Linux Foundation. All rights reserved.
* Copyright (c) 2017-2018 The Linux Foundation. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
@@ -208,4 +208,32 @@ struct wlan_objmgr_vdev *wlan_util_get_vdev_by_ifname(
return filter.found_vdev;
}
EXPORT_SYMBOL(wlan_util_get_vdev_by_ifname);
/**
* wlan_util_vdev_get_if_name() - get vdev's interface name
* @vdev: VDEV object
*
* API to get vdev's interface name
*
* Return:
* @id: vdev's interface name
*/
uint8_t *wlan_util_vdev_get_if_name(struct wlan_objmgr_vdev *vdev)
{
uint8_t *name;
struct vdev_osif_priv *osif_priv;
wlan_vdev_obj_lock(vdev);
osif_priv = wlan_vdev_get_ospriv(vdev);
if (!osif_priv) {
wlan_vdev_obj_unlock(vdev);
return NULL;
}
name = osif_priv->wdev->netdev->name;
wlan_vdev_obj_unlock(vdev);
return name;
}
EXPORT_SYMBOL(wlan_util_vdev_get_if_name);