From 68e72488abd96b39e49ecfb7c1a790e35e73ebe5 Mon Sep 17 00:00:00 2001 From: Purushottam Kushwaha Date: Mon, 20 Aug 2018 12:18:04 +0530 Subject: [PATCH 1/2] QSAP: add support to set acs_exclude_dfs parameter. acs_exclude_dfs is needed to avoid selection of DFS channels when ACS (channel=0) is set for 5Ghz. This commit adds support for this acs_exclude_dfs parameter. Change-Id: If8a8777e7ec45bd37fd7e94e6f114852b2636b0c CRs-Fixed: 2299524 --- softap/sdk/qsap_api.c | 1 + softap/sdk/qsap_api.h | 1 + 2 files changed, 2 insertions(+) diff --git a/softap/sdk/qsap_api.c b/softap/sdk/qsap_api.c index 2bbad60..4bf4658 100644 --- a/softap/sdk/qsap_api.c +++ b/softap/sdk/qsap_api.c @@ -181,6 +181,7 @@ static struct Command cmd_list[eCMD_LAST] = { { "ctrl_interface", NULL }, { "vendor_elements", NULL }, { "assocresp_elements", NULL }, + { "acs_exclude_dfs", NULL }, }; struct Command qsap_str[eSTR_LAST] = { diff --git a/softap/sdk/qsap_api.h b/softap/sdk/qsap_api.h index 900ff6a..89e7a88 100644 --- a/softap/sdk/qsap_api.h +++ b/softap/sdk/qsap_api.h @@ -350,6 +350,7 @@ typedef enum esap_cmd { eCMD_CTRL_INTERFACE = 76, eCMD_VENDOR_ELEMENT = 77, eCMD_ASSOCRESP_ELEMENT = 78, + eCMD_ACS_EXCLUDE_DFS = 79, eCMD_LAST /** New command numbers should be added above this */ } esap_cmd_t; From 71d1ddbe77047a0a6d8fe4cac38db114977fb709 Mon Sep 17 00:00:00 2001 From: Srikanth Marepalli Date: Thu, 23 Aug 2018 19:15:57 +0530 Subject: [PATCH 2/2] 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 --- softap/sdk/qsap_api.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/softap/sdk/qsap_api.c b/softap/sdk/qsap_api.c index 4bf4658..4c48cb2 100644 --- a/softap/sdk/qsap_api.c +++ b/softap/sdk/qsap_api.c @@ -1349,6 +1349,12 @@ int qsap_get_mode(s32 *pmode) //allocate socket sk = nl_socket_alloc(); + //return if socket allocation fails + if(sk == NULL){ + ALOGE( "socket allocation failure"); + return ret; + } + //connect to generic netlink if (genl_connect(sk)) { ALOGE( "Netlink socket Connection failure"); @@ -1366,6 +1372,12 @@ int qsap_get_mode(s32 *pmode) //allocate a message msg = nlmsg_alloc(); + //return if message allocation fails + if(msg == NULL){ + ALOGE( "message allocation failure"); + goto nla_put_failure; + } + // setup the message genlmsg_put(msg, 0, 0, nl80211_id, 0, 0, NL80211_CMD_GET_INTERFACE, 0);