mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-31 06:15:24 +00:00
unix: Check service client for being null
For regular dumps this thing is not initialized. Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
/*
|
||||
@@ -97,7 +102,7 @@ static int can_dump_unix_sk(const struct unix_sk_desc *sk)
|
||||
*/
|
||||
if (sk->type != SOCK_STREAM &&
|
||||
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");
|
||||
return 0;
|
||||
}
|
||||
@@ -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.
|
||||
* 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.peer = 0;
|
||||
ue.uflags |= USK_SERVICE;
|
||||
|
Reference in New Issue
Block a user