[CRIU] [PATCH] lazy_image(): avoid NULL deref

Kir Kolyshkin kir at openvz.org
Thu Apr 30 16:25:43 PDT 2015


Do check img before deferefencing, just as in empty_image().
This is an addition to commit 8ce37e67.

Signed-off-by: Kir Kolyshkin <kir at openvz.org>
---
 include/image.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/image.h b/include/image.h
index 55e63dd..76ad2e8 100644
--- a/include/image.h
+++ b/include/image.h
@@ -146,7 +146,7 @@ static inline bool empty_image(struct cr_img *img)
 
 static inline bool lazy_image(struct cr_img *img)
 {
-	return img->_x.fd == LAZY_IMG_FD;
+	return img && img->_x.fd == LAZY_IMG_FD;
 }
 
 extern int open_image_lazy(struct cr_img *img);
-- 
1.9.3



More information about the CRIU mailing list