Commit fdb7bde5 authored by Kirill Tkhai's avatar Kirill Tkhai Committed by Andrei Vagin

unix: Move dump_sk_queue() before peer resolution

When we allow unix sockets sent over unix sockets,
dump_sk_queue() may dump and resolve some peers.
So, we need run it firstly and avoid linking our
peer_node to peer's peer_list.
Signed-off-by: 's avatarKirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: 's avatarAndrei Vagin <avagin@virtuozzo.com>
parent 254958ce
...@@ -347,6 +347,18 @@ static int dump_one_unix_fd(int lfd, u32 id, const struct fd_parms *p) ...@@ -347,6 +347,18 @@ static int dump_one_unix_fd(int lfd, u32 id, const struct fd_parms *p)
sk_encode_shutdown(ue, sk->shutdown); sk_encode_shutdown(ue, sk->shutdown);
/*
* If a stream listening socket has non-zero rqueue, this
* means there are in-flight connections waiting to get
* accept()-ed. We handle them separately with the "icons"
* (i stands for in-flight, cons -- for connections) things.
*/
if (sk->rqlen != 0 && !(sk->type == SOCK_STREAM &&
sk->state == TCP_LISTEN)) {
if (dump_sk_queue(lfd, id))
goto err;
}
if (ue->peer) { if (ue->peer) {
peer = (struct unix_sk_desc *)lookup_socket(ue->peer, PF_UNIX, 0); peer = (struct unix_sk_desc *)lookup_socket(ue->peer, PF_UNIX, 0);
if (IS_ERR_OR_NULL(peer)) { if (IS_ERR_OR_NULL(peer)) {
...@@ -444,17 +456,6 @@ dump: ...@@ -444,17 +456,6 @@ dump:
if (dump_socket_opts(lfd, skopts)) if (dump_socket_opts(lfd, skopts))
goto err; goto err;
/*
* If a stream listening socket has non-zero rqueue, this
* means there are in-flight connections waiting to get
* accept()-ed. We handle them separately with the "icons"
* (i stands for in-flight, cons -- for connections) things.
*/
if (sk->rqlen != 0 && !(sk->type == SOCK_STREAM &&
sk->state == TCP_LISTEN))
if (dump_sk_queue(lfd, id))
goto err;
pr_info("Dumping unix socket at %d\n", p->fd); pr_info("Dumping unix socket at %d\n", p->fd);
show_one_unix("Dumping", sk); show_one_unix("Dumping", sk);
...@@ -478,6 +479,7 @@ dump: ...@@ -478,6 +479,7 @@ dump:
if (write_unix_entry(psk)) if (write_unix_entry(psk))
return -1; return -1;
psk->sd.already_dumped = 1;
} }
return 0; return 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment