diff options
| author | Vinay Krishna Eranna <veran@codeaurora.org> | 2014-06-26 21:39:03 +0530 |
|---|---|---|
| committer | Mister Oyster <oysterized@gmail.com> | 2017-04-16 15:03:37 +0200 |
| commit | 7891c2f91f978a98e669d24c486b2b25aa72b226 (patch) | |
| tree | d4b06b54acf2924963304f5b0935f8bb185da2f2 | |
| parent | d97c983cab77e60f49223f7990e82e510c2b51c8 (diff) | |
netlink: Queue the kernel socket after setting the flag.
Queueing the socket after setting the NETLINK_KERNEL_SOCKET on the
kernel socket.
This change is required in-order to avoid the BUG check which is
caused due to race condition between setting this flag and a
message from the app space for this kernel netlink sock.
Change-Id: I19a8edf2fe009a3020b194684a6172654f8f257a
CRs-Fixed: 681815
Signed-off-by: Vinay Krishna Eranna <veran@codeaurora.org>
| -rw-r--r-- | net/netlink/af_netlink.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c index 51adacb6e..20fda4ee1 100644 --- a/net/netlink/af_netlink.c +++ b/net/netlink/af_netlink.c @@ -512,7 +512,7 @@ static unsigned int netlink_poll(struct file *file, struct socket *sock, * for dumps is performed here. A dump is allowed to continue * if at least half the ring is unused. */ - while (nlk->cb_running && netlink_dump_space(nlk)) { + while (nlk->cb_running && netlink_dump_space(nlk)) { err = netlink_dump(sk); if (err < 0) { sk->sk_err = -err; @@ -2252,8 +2252,8 @@ static int netlink_recvmsg(struct kiocb *kiocb, struct socket *sock, skb_free_datagram(sk, skb); - if (nlk->cb_running && - atomic_read(&sk->sk_rmem_alloc) <= sk->sk_rcvbuf / 2) { + if (nlk->cb_running && + atomic_read(&sk->sk_rmem_alloc) <= sk->sk_rcvbuf / 2) { ret = netlink_dump(sk); if (ret) { sk->sk_err = -ret; @@ -2322,12 +2322,12 @@ __netlink_kernel_create(struct net *net, int unit, struct module *module, if (cfg && cfg->input) nlk_sk(sk)->netlink_rcv = cfg->input; - if (netlink_insert(sk, net, 0)) - goto out_sock_release; - nlk = nlk_sk(sk); nlk->flags |= NETLINK_KERNEL_SOCKET; + if (netlink_insert(sk, net, 0)) + goto out_sock_release; + netlink_table_grab(); if (!nl_table[unit].registered) { nl_table[unit].groups = groups; @@ -2815,7 +2815,7 @@ static int netlink_seq_show(struct seq_file *seq, void *v) struct sock *s = v; struct netlink_sock *nlk = nlk_sk(s); - seq_printf(seq, "%pK %-3d %-6u %08x %-8d %-8d %d %-8d %-8d %-8lu\n", + seq_printf(seq, "%pK %-3d %-6u %08x %-8d %-8d %d %-8d %-8d %-8lu\n", s, s->sk_protocol, (int)(nlk->portid), |
