===== net/netlink/af_netlink.c 1.48 vs edited ===== --- 1.48/net/netlink/af_netlink.c 2004-06-19 04:43:31 +10:00 +++ edited/net/netlink/af_netlink.c 2004-06-30 20:53:00 +10:00 @@ -365,6 +365,7 @@ struct sockaddr_nl *nladdr=(struct sockaddr_nl*)addr; if (addr->sa_family == AF_UNSPEC) { + sock->state = SS_UNCONNECTED; nlk->dst_pid = 0; nlk->dst_groups = 0; return 0; @@ -380,6 +381,7 @@ err = netlink_autobind(sock); if (err == 0) { + sock->state = SS_CONNECTED; nlk->dst_pid = nladdr->nl_pid; nlk->dst_groups = nladdr->nl_groups; } @@ -428,6 +430,12 @@ /* Don't bother queuing skb if kernel socket has no input function */ nlk = nlk_sk(sock); if (nlk->pid == 0 && !nlk->data_ready) { + sock_put(sock); + return ERR_PTR(-ECONNREFUSED); + } + + if (sock->sk_socket->state == SS_CONNECTED && + nlk->dst_pid != nlk_sk(ssk)->pid) { sock_put(sock); return ERR_PTR(-ECONNREFUSED); }