[CRIU] [PATCH] lazy_image(): avoid NULL deref
Kir Kolyshkin
kir at openvz.org
Tue May 5 12:17:47 PDT 2015
On 05/05/2015 03:46 AM, Pavel Emelyanov wrote:
> 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?
There was at least one condition that lead to lazy_image() potentially
being called
with NULL argument, which is now fixed by commit 8ac865f3ee. Now I am not
aware of any, so I am not sure if we should have this patch or not.
>
>> 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