wlan: Avoid calling sleeping functions during multicast of nl messages

In the current code, when sending mutlticast nl messages to userspace,
GFP_KERNEL flag is passed and there is possibility of sleeping kernel
API being called from soft irq context and because of this kernel may
complain. So, before sending multicast nl messages, the current
execution context is verified and suitable flag (either GFP_KERNEL or
GFP_ATOMIC) is passed so that sleep can be prevented.

Change-Id: If0e7d45719ee2a5d3e176cf34e920155985e7bc1
CRs-Fixed: 828852
diff --git a/CORE/HDD/src/wlan_hdd_main.c b/CORE/HDD/src/wlan_hdd_main.c
index 4d24c15..2e869a5 100755
--- a/CORE/HDD/src/wlan_hdd_main.c
+++ b/CORE/HDD/src/wlan_hdd_main.c
@@ -8819,8 +8819,12 @@
        struct sk_buff *skb;
        struct nlmsghdr *nlh;
        tAniMsgHdr *ani_hdr;
+       int flags = GFP_KERNEL;
 
-       skb = alloc_skb(NLMSG_SPACE(WLAN_NL_MAX_PAYLOAD), GFP_KERNEL);
+       if (in_interrupt() || irqs_disabled() || in_atomic())
+           flags = GFP_ATOMIC;
+
+       skb = alloc_skb(NLMSG_SPACE(WLAN_NL_MAX_PAYLOAD), flags);
 
        if(skb == NULL) {
                VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
diff --git a/CORE/SVC/src/nlink/wlan_nlink_srv.c b/CORE/SVC/src/nlink/wlan_nlink_srv.c
index a1dfc8a..3c4109d 100644
--- a/CORE/SVC/src/nlink/wlan_nlink_srv.c
+++ b/CORE/SVC/src/nlink/wlan_nlink_srv.c
@@ -188,6 +188,10 @@
 int nl_srv_bcast(struct sk_buff *skb)
 {
    int err;
+   int flags = GFP_KERNEL;
+
+   if (in_interrupt() || irqs_disabled() || in_atomic())
+       flags = GFP_ATOMIC;
 
 #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0))
    NETLINK_CB(skb).pid = 0; //sender's pid
@@ -196,7 +200,7 @@
 #endif
    NETLINK_CB(skb).dst_group = WLAN_NLINK_MCAST_GRP_ID; //destination group
 
-   err = netlink_broadcast(nl_srv_sock, skb, 0, WLAN_NLINK_MCAST_GRP_ID, GFP_KERNEL);
+   err = netlink_broadcast(nl_srv_sock, skb, 0, WLAN_NLINK_MCAST_GRP_ID, flags);
 
    if (err < 0)
    {