summaryrefslogtreecommitdiff
path: root/qcwcn/wifi_hal/wifi_hal.cpp
diff options
context:
space:
mode:
authorSubhani Shaik <subhanis@codeaurora.org>2016-02-25 11:17:57 +0800
committerEcco Park <eccopark@google.com>2016-07-25 11:40:31 -0700
commit2288a41b30e45c2e0e633043f31678eee1103d2c (patch)
tree79bcb29a3a3c1dfad15d329f5bbb8b38d35acfb5 /qcwcn/wifi_hal/wifi_hal.cpp
parent84228ea6c6aaabd4717dc8932f1b0a73b6105d88 (diff)
downloadwlan-2288a41b30e45c2e0e633043f31678eee1103d2c.tar.gz
Wifi-Hal: Set nl socket's local port with nl api
The nl library maintains one local port pool for nl sockets, one port is occupied when new nl socket is allocated and it needs to released, otherwise the nl socket allocation will fail since no local port can be used in nl socket allocation. Wifi hal sets own local port for nl socket directly without calling api and causes leak. BUG: 30350620 Change-Id: I4bb1fd2c352c73cc246a2ba7f837e395f022651f
Diffstat (limited to 'qcwcn/wifi_hal/wifi_hal.cpp')
-rw-r--r--qcwcn/wifi_hal/wifi_hal.cpp13
1 files changed, 4 insertions, 9 deletions
diff --git a/qcwcn/wifi_hal/wifi_hal.cpp b/qcwcn/wifi_hal/wifi_hal.cpp
index 2f78718..64c0143 100644
--- a/qcwcn/wifi_hal/wifi_hal.cpp
+++ b/qcwcn/wifi_hal/wifi_hal.cpp
@@ -97,15 +97,10 @@ wifi_interface_handle wifi_get_iface_handle(wifi_handle handle, char *name)
void wifi_socket_set_local_port(struct nl_sock *sock, uint32_t port)
{
- uint32_t pid = getpid() & 0x3FFFFF;
-
- if (port == 0) {
- sock->s_flags &= ~NL_OWN_PORT;
- } else {
- sock->s_flags |= NL_OWN_PORT;
- }
-
- sock->s_local.nl_pid = pid + (port << 22);
+ /* Release local port pool maintained by libnl and assign a own port
+ * identifier to the socket.
+ */
+ nl_socket_set_local_port(sock, ((uint32_t)getpid() & 0x3FFFFFU) | (port << 22));
}
static nl_sock * wifi_create_nl_socket(int port, int protocol)