Commit 935c8e75 authored by Cyrill Gorcunov's avatar Cyrill Gorcunov

net: sockets -- Use read_ptr_safe for magic number test

Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
parent 4432c644
...@@ -588,7 +588,7 @@ err: ...@@ -588,7 +588,7 @@ err:
static int prepare_unix_sockets(int pid) static int prepare_unix_sockets(int pid)
{ {
int usk_fd, ret; int usk_fd, ret = -1;
u32 type; u32 type;
usk_fd = open_image_ro(FMT_FNAME_UNIXSK, pid); usk_fd = open_image_ro(FMT_FNAME_UNIXSK, pid);
...@@ -597,9 +597,9 @@ static int prepare_unix_sockets(int pid) ...@@ -597,9 +597,9 @@ static int prepare_unix_sockets(int pid)
return -1; return -1;
} }
read(usk_fd, &type, sizeof(type)); read_ptr_safe(usk_fd, &type, err);
if (type != UNIXSK_MAGIC) { if (type != UNIXSK_MAGIC) {
pr_perror("%d: Bad unix sk file\n", pid); pr_err("%d: Bad unix sk file\n", pid);
return -1; return -1;
} }
...@@ -628,6 +628,7 @@ static int prepare_unix_sockets(int pid) ...@@ -628,6 +628,7 @@ static int prepare_unix_sockets(int pid)
if (!ret) if (!ret)
ret = run_accept_jobs(); ret = run_accept_jobs();
err:
return ret; return ret;
} }
......
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