qcacmn: 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
This commit is contained in:
Ashish Kumar Dhanotiya 2017-03-01 18:12:34 +05:30 • committed by qcabuildsw
commit 55e1d72428
2 changed files with 36 additions and 21 deletions

View file

@ -138,8 +138,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);
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;
@ -170,8 +177,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);
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;
@ -350,19 +364,21 @@ int nl_srv_unregister(tWlanNlModTypes msg_type, nl_srv_msg_callback msg_handler)
*/
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;
}
@ -372,7 +388,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())
@ -381,14 +397,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;
}