summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorAshish Kumar Dhanotiya <adhanoti@codeaurora.org>2017-02-27 16:14:07 +0530
committerPrakash Dhavali <pdhavali@codeaurora.org>2017-03-09 21:08:49 -0800
commit7ebdd16d6ad5559ecb37b5ccf77b044cb97d94dd (patch)
tree8f844389035c72d0c0d8edf5e73903de7be0bf12 /core
parent161757bd66fe393acdd2942c2e166e4798117d9c (diff)
qcacld-3.0: Fix wlan log svc leaks
There is a memory leak within wlan logging thread. To address this issue free the memory at appropriate places. Change-Id: I41c7756d6547c0bfa783a48ebc31c9f1ef0df5db CRs-Fixed: 2011525
Diffstat (limited to 'core')
-rw-r--r--core/utils/logging/src/wlan_logging_sock_svc.c4
-rw-r--r--core/utils/nlink/src/wlan_nlink_srv.c55
2 files changed, 36 insertions, 23 deletions
diff --git a/core/utils/logging/src/wlan_logging_sock_svc.c b/core/utils/logging/src/wlan_logging_sock_svc.c
index cdc6e9860ac4..4be3e1dff3f3 100644
--- a/core/utils/logging/src/wlan_logging_sock_svc.c
+++ b/core/utils/logging/src/wlan_logging_sock_svc.c
@@ -745,10 +745,6 @@ static int send_filled_buffers_to_user(void)
if (ret < 0 && (!(gwlan_logging.drop_count % 0x40))) {
pr_err("%s: Send Failed %d drop_count = %u\n",
__func__, ret, ++gwlan_logging.drop_count);
- skb = NULL;
- } else {
- skb = NULL;
- ret = 0;
}
}
diff --git a/core/utils/nlink/src/wlan_nlink_srv.c b/core/utils/nlink/src/wlan_nlink_srv.c
index b8b8e2aab114..4b83574b2a98 100644
--- a/core/utils/nlink/src/wlan_nlink_srv.c
+++ b/core/utils/nlink/src/wlan_nlink_srv.c
@@ -145,9 +145,15 @@ int nl_srv_ucast(struct sk_buff *skb, int dst_pid, int flag)
/* not multicast */
NETLINK_CB(skb).dst_group = 0;
- if (nl_srv_is_initialized() == 0)
+ if (nl_srv_is_initialized() == 0) {
err = cnss_logger_nl_ucast(skb, dst_pid, flag);
- else
+ if (err < 0) {
+ QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_WARN,
+ "NLINK: netlink_unicast to pid[%d] failed, ret[%d]",
+ dst_pid, err);
+ dev_kfree_skb(skb);
+ }
+ } else
dev_kfree_skb(skb);
return err;
}
@@ -177,9 +183,15 @@ int nl_srv_bcast(struct sk_buff *skb)
/* destination group */
NETLINK_CB(skb).dst_group = WLAN_NLINK_MCAST_GRP_ID;
- if (nl_srv_is_initialized() == 0)
+ if (nl_srv_is_initialized() == 0) {
err = cnss_logger_nl_bcast(skb, WLAN_NLINK_MCAST_GRP_ID, flags);
- else
+ if ((err < 0) && (err != -ESRCH)) {
+ QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_WARN,
+ "NLINK: netlink_broadcast failed err = %d",
+ err);
+ dev_kfree_skb(skb);
+ }
+ } else
dev_kfree_skb(skb);
return err;
}
@@ -546,19 +558,21 @@ int nl_srv_ucast(struct sk_buff *skb, int dst_pid, int flag,
*/
int nl_srv_ucast(struct sk_buff *skb, int dst_pid, int flag)
{
- int err = 0;
+ int err = -EINVAL;
NETLINK_CB(skb).portid = 0; /* sender's pid */
NETLINK_CB(skb).dst_group = 0; /* not multicast */
- if (nl_srv_sock)
+ if (nl_srv_sock) {
err = netlink_unicast(nl_srv_sock, skb, dst_pid, flag);
-
- if (err < 0)
- QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_WARN,
- "NLINK: netlink_unicast to pid[%d] failed, ret[%d]",
- dst_pid, err);
-
+ if (err < 0) {
+ QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_WARN,
+ "NLINK: netlink_unicast to pid[%d] failed, ret[%d]",
+ dst_pid, err);
+ dev_kfree_skb(skb);
+ }
+ } else
+ dev_kfree_skb(skb);
return err;
}
@@ -568,7 +582,7 @@ int nl_srv_ucast(struct sk_buff *skb, int dst_pid, int flag)
*/
int nl_srv_bcast(struct sk_buff *skb)
{
- int err = 0;
+ int err = -EINVAL;
int flags = GFP_KERNEL;
if (in_interrupt() || irqs_disabled() || in_atomic())
@@ -577,14 +591,17 @@ int nl_srv_bcast(struct sk_buff *skb)
NETLINK_CB(skb).portid = 0; /* sender's pid */
NETLINK_CB(skb).dst_group = WLAN_NLINK_MCAST_GRP_ID; /* destination group */
- if (nl_srv_sock)
+ if (nl_srv_sock) {
err = netlink_broadcast(nl_srv_sock, skb, 0,
WLAN_NLINK_MCAST_GRP_ID, flags);
-
- if ((err < 0) && (err != -ESRCH)) {
- QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_WARN,
- "NLINK: netlink_broadcast failed err = %d", err);
- }
+ if ((err < 0) && (err != -ESRCH)) {
+ QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_WARN,
+ "NLINK: netlink_broadcast failed err = %d",
+ err);
+ dev_kfree_skb(skb);
+ }
+ } else
+ dev_kfree_skb(skb);
return err;
}
#endif