[CRIU] [PATCH 1/2] ids: Make sure root ids is present in image

Pavel Emelyanov xemul at parallels.com
Fri Mar 15 05:52:08 EDT 2013


On 03/15/2013 01:45 PM, Cyrill Gorcunov wrote:
> On Fri, Mar 15, 2013 at 01:41:11PM +0400, Pavel Emelyanov wrote:
>> On 03/15/2013 12:50 AM, Cyrill Gorcunov wrote:
>>> Otherwise yield error instead of nil dereference.
>>>
>>> Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
>>> ---
>>>  pstree.c | 12 +++++++++++-
>>>  1 file changed, 11 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/pstree.c b/pstree.c
>>> index 5bfcbdc..4f4d938 100644
>>> --- a/pstree.c
>>> +++ b/pstree.c
>>> @@ -494,9 +494,19 @@ static int prepare_pstree_kobj_ids(void)
>>>  
>>>  		if (parent)
>>>  			ids = parent->ids;
>>> -		else
>>> +		else {
>>>  			ids = root_ids;
>>>  
>>> +			/*
>>> +			 * Add some sanity check on image data.
>>> +			 */
>>> +			if (unlikely(!ids)) {
>>
>> The if (!ids) should be checked for parent->ids case as well.
> 
> read_pstree_image
> 	...
> 		ret = pb_read_one(fd, &pi->ids, PB_IDS);
> 		close(fd);
> 		if (ret != 1)
> 			goto err;
> 
> so parent->ids can't be nil here.

So item->ids cannot be NULL as well, why do you think we have
this check above then?

> .
> 




More information about the CRIU mailing list