[CRIU] [PATCH] lazy_image(): avoid NULL deref
Pavel Emelyanov
xemul at parallels.com
Tue May 5 03:46:11 PDT 2015
On 05/01/2015 02:25 AM, Kir Kolyshkin wrote:
> Do check img before deferefencing, just as in empty_image().
Is it a real bug fix, or just to be on the safe side?
> 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);
>
More information about the CRIU
mailing list