Commit 54a6a794 authored by Pavel Emelyanov's avatar Pavel Emelyanov

unix: Check service client for being null

For regular dumps this thing is not initialized.
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 4c504f5d
...@@ -88,6 +88,11 @@ static void show_one_unix_img(const char *act, const UnixSkEntry *e) ...@@ -88,6 +88,11 @@ static void show_one_unix_img(const char *act, const UnixSkEntry *e)
act, e->id, e->ino, e->peer, e->type, e->state, (int)e->name.len); act, e->id, e->ino, e->peer, e->type, e->state, (int)e->name.len);
} }
static bool service_socket(unsigned int sk_ino)
{
return cr_service_client && (cr_service_client->sk_ino == sk_ino);
}
static int can_dump_unix_sk(const struct unix_sk_desc *sk) static int can_dump_unix_sk(const struct unix_sk_desc *sk)
{ {
/* /*
...@@ -97,7 +102,7 @@ static int can_dump_unix_sk(const struct unix_sk_desc *sk) ...@@ -97,7 +102,7 @@ static int can_dump_unix_sk(const struct unix_sk_desc *sk)
*/ */
if (sk->type != SOCK_STREAM && if (sk->type != SOCK_STREAM &&
sk->type != SOCK_DGRAM && sk->type != SOCK_DGRAM &&
sk->peer_ino != cr_service_client->sk_ino) { !service_socket(sk->peer_ino)) {
pr_err("Only stream/dgram sockets for now\n"); pr_err("Only stream/dgram sockets for now\n");
return 0; return 0;
} }
...@@ -149,7 +154,7 @@ static int dump_one_unix_fd(int lfd, u32 id, const struct fd_parms *p) ...@@ -149,7 +154,7 @@ static int dump_one_unix_fd(int lfd, u32 id, const struct fd_parms *p)
* Check if this socket is connected to criu service. * Check if this socket is connected to criu service.
* Dump it like closed one and mark it for restore. * Dump it like closed one and mark it for restore.
*/ */
if (ue.peer == cr_service_client->sk_ino) { if (service_socket(ue.peer)) {
ue.state = TCP_CLOSE; ue.state = TCP_CLOSE;
ue.peer = 0; ue.peer = 0;
ue.uflags |= USK_SERVICE; ue.uflags |= USK_SERVICE;
......
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