[Devel] Re: [PATCH] e1000: ring buffers resources cleanup

Vasily Averin vvs at sw.ru
Sat Aug 19 13:14:09 PDT 2006


Hello Joe,

Joe Perches wrote:
> On Fri, 2006-08-18 at 19:02 +0400, Vasily Averin wrote:
>>Memory leak was found in 2.6.18-rc4 and e1000 7.2.7 from sourceforge:
>>We should free resources allocated for previous rings if following allocation fails.
> 
> Did you read the comment headers in the function?
> 
>  * If this function returns with an error, then it's possible one or
>  * more of the rings is populated (while the rest are not).  It is the
>  * callers duty to clean those orphaned rings.

Thank you for your notice.
I believe this comment is incorrect: if some function returns an error it should
restore original state on exit, otherwise can lead to resource leaks. Also I
would note that this requirements is not accomplished in current driver version:
e1000_setup_all_Xx_resources functions are called in two places: in
e1000_set_ringparam() and in e1000_open() and in both cases nobody cleans those
orphaned rings.

Therefore I think it make sense to remove these comments too.

Andrew, could you please use attached patch instead previous version?
---
Memory leak was found in 2.6.18-rc4 and e1000 7.2.7 from sourceforge:
We should free resources allocated for previous rings if following allocation
fails. Also incorrect comments in e1000_setup_all_Xx_resources() are removed

Signed-off-by: Vasily Averin <vvs at sw.ru>

Thank you,
	Vasily Averin
SWsoft Virtuozzo/OpenVZ Linux kernel team
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: diff-e1000-ringresources-20060819
URL: <http://lists.openvz.org/pipermail/devel/attachments/20060820/3c32712d/attachment-0001.ksh>


More information about the Devel mailing list