qsap: Add NULL check for soc & msg allocations in qsap_get_mode
Add appropriate checks to avoid NULL pointer dereferencing. Change-Id: I9b96eeb1cf3b860416c950b5c689dc5858e194c6 CRs-Fixed: 2300013
This commit is contained in:
committed by
Gerrit - the friendly Code Review server
parent
68e72488ab
commit
71d1ddbe77
@@ -1349,6 +1349,12 @@ int qsap_get_mode(s32 *pmode)
|
|||||||
//allocate socket
|
//allocate socket
|
||||||
sk = nl_socket_alloc();
|
sk = nl_socket_alloc();
|
||||||
|
|
||||||
|
//return if socket allocation fails
|
||||||
|
if(sk == NULL){
|
||||||
|
ALOGE( "socket allocation failure");
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
//connect to generic netlink
|
//connect to generic netlink
|
||||||
if (genl_connect(sk)) {
|
if (genl_connect(sk)) {
|
||||||
ALOGE( "Netlink socket Connection failure");
|
ALOGE( "Netlink socket Connection failure");
|
||||||
@@ -1366,6 +1372,12 @@ int qsap_get_mode(s32 *pmode)
|
|||||||
//allocate a message
|
//allocate a message
|
||||||
msg = nlmsg_alloc();
|
msg = nlmsg_alloc();
|
||||||
|
|
||||||
|
//return if message allocation fails
|
||||||
|
if(msg == NULL){
|
||||||
|
ALOGE( "message allocation failure");
|
||||||
|
goto nla_put_failure;
|
||||||
|
}
|
||||||
|
|
||||||
// setup the message
|
// setup the message
|
||||||
genlmsg_put(msg, 0, 0, nl80211_id, 0, 0, NL80211_CMD_GET_INTERFACE, 0);
|
genlmsg_put(msg, 0, 0, nl80211_id, 0, 0, NL80211_CMD_GET_INTERFACE, 0);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user