lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <53FDADA5.6070802@citrix.com>
Date:	Wed, 27 Aug 2014 11:06:29 +0100
From:	David Vrabel <david.vrabel@...rix.com>
To:	Chen Gang <gang.chen.5i5j@...il.com>
CC:	<konrad.wilk@...cle.com>, <boris.ostrovsky@...cle.com>,
	<xen-devel@...ts.xenproject.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] drivers/xen/grant-table.c: Be sure of unsigned value
 never comparing with 0

On 26/08/14 20:42, Chen Gang wrote:
> On 08/27/2014 01:03 AM, David Vrabel wrote:
>> On 26/08/14 16:38, Chen Gang wrote:
>>> In grow_gnttab_list(), 'i' is 'unsigned int', and 'nr_glist_frames' may
>>> be 0 because 'nr_grant_frames' may be 0. So 'i' may never be less than
>>> 'nr_glist_frames' in failure processing, which cause infinite looping.
>>
>> nr_grant_frames is at least 1.  See gnttab_init().
>>
> 
> OK, thanks, that sounds reasonable to me, it is not a real wold bug, it
> is my fault.  :-)
> 
>>> --- a/drivers/xen/grant-table.c
>>> +++ b/drivers/xen/grant-table.c
>>> @@ -592,8 +592,8 @@ static int grow_gnttab_list(unsigned int more_frames)
>>>  	return 0;
>>>  
>>>  grow_nomem:
>>> -	for ( ; i >= nr_glist_frames; i--)
>>> -		free_page((unsigned long) gnttab_list[i]);
>>> +	while (i > nr_glist_frames)
>>> +		free_page((unsigned long) gnttab_list[--i]);
>>
>> while (i-- > nr_glist_frames)
>>     ...
>>
>> Would have been better.
>>
> 
> OK, thanks, that sounds reasonable to me.
> 
> If necessary to send patch v2 (change comments and contents), please
> let me know, and I shall send.

Applied to devel/for-linus-3.18 with this description:

    xen/grant-table: refactor error cleanup in grow_gnttab_list()

    The cleanup loop in grow_gnttab_list() is safe from the underflow of
    the unsigned 'i' since nr_glist_frames is >= 1, but refactor it
    anyway.

Thanks.

David
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ