[CRIU] [PATCH] sockets: Fix int ino parameter of socket functions

Kirill Tkhai ktkhai at virtuozzo.com
Thu Jun 16 08:22:53 PDT 2016


Real ino is u32, while parameters are int. Fix that
to prevent crap with overflows.

Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
 criu/include/sockets.h |    4 ++--
 criu/sockets.c         |    4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/criu/include/sockets.h b/criu/include/sockets.h
index b3bacb7..cbecd80 100644
--- a/criu/include/sockets.h
+++ b/criu/include/sockets.h
@@ -33,7 +33,7 @@ extern void preload_socket_modules();
 
 extern bool socket_test_collect_bit(unsigned int family, unsigned int proto);
 
-extern int sk_collect_one(int ino, int family, struct socket_desc *d);
+extern int sk_collect_one(unsigned ino, int family, struct socket_desc *d);
 struct ns_id;
 extern int collect_sockets(struct ns_id *);
 extern int collect_inet_sockets(void);
@@ -42,7 +42,7 @@ extern int fix_external_unix_sockets(void);
 
 extern struct collect_image_info netlink_sk_cinfo;
 
-extern struct socket_desc *lookup_socket(int ino, int family, int proto);
+extern struct socket_desc *lookup_socket(unsigned ino, int family, int proto);
 
 extern const struct fdtype_ops unix_dump_ops;
 extern const struct fdtype_ops inet_dump_ops;
diff --git a/criu/sockets.c b/criu/sockets.c
index d8d09aa..ffc4f39 100644
--- a/criu/sockets.c
+++ b/criu/sockets.c
@@ -330,7 +330,7 @@ static int restore_socket_filter(int sk, SkOptsEntry *soe)
 
 static struct socket_desc *sockets[SK_HASH_SIZE];
 
-struct socket_desc *lookup_socket(int ino, int family, int proto)
+struct socket_desc *lookup_socket(unsigned ino, int family, int proto)
 {
 	struct socket_desc *sd;
 
@@ -350,7 +350,7 @@ struct socket_desc *lookup_socket(int ino, int family, int proto)
 	return NULL;
 }
 
-int sk_collect_one(int ino, int family, struct socket_desc *d)
+int sk_collect_one(unsigned ino, int family, struct socket_desc *d)
 {
 	struct socket_desc **chain;
 



More information about the CRIU mailing list