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: <4B5F1164.8030102@gmail.com>
Date:	Tue, 26 Jan 2010 16:59:32 +0100
From:	Roel Kluin <roel.kluin@...il.com>
To:	Jeff Kirsher <jeffrey.t.kirsher@...el.com>, davem@...emloft.net
CC:	Anton Blanchard <anton@...ba.org>,
	Jesse Brandeburg <jesse.brandeburg@...el.com>,
	Bruce Allan <bruce.w.allan@...el.com>,
	PJ Waskiewicz <peter.p.waskiewicz.jr@...el.com>,
	John Ronciak <john.ronciak@...el.com>,
	Don Skidmore <donald.c.skidmore@...el.com>,
	Yi Zou <yi.zou@...el.com>,
	Alexander Duyck <alexander.h.duyck@...el.com>,
	e1000-devel@...ts.sourceforge.net, netdev@...r.kernel.org
Subject: Re: [PATCH 1/2] e1000: Fix DMA mapping error handling on TX


>>> This patch does not apply to the current e1000 driver in net-2.6, much
>>> of this patch has already been corrected (applied) by Roel Kluin
>>> recent patch.
>>
>> Sorry I was basing off net-next. I just compared it to my fix and looks like
>> the patch in net-2.6 has an off by one error doesn't it?
> 
> This was discussed during our code review of Roel's patch, and it was
> found that there was not an issue.  But I will review the code again
> to ensure that there is not "an off by one error".  Thanks for looking
> at this.

He is right, as also reported by Juha Leppanen:

> Before your patch I suppose the logic disregarding the signed/unsigned error was :
> 1) if count==0, no unmapping/freeing inside while loop
> 2) if count>0, do 'count' loops unmapping/freeing
> 
> After your patch the logic is :
> 1) if count==0, no unmapping/freeing inside while loop
> 1) if count==1, no unmapping/freeing inside while loop
> 2) if count>1, do 'count-1' loops unmapping/freeing

> Can tx_ring->count be zero? I hope not.

His suggested fix works:

> dma_error:
> 	dev_err(&pdev->dev, "TX DMA map failed\n");
> 	buffer_info->dma = 0;
> -	if (count)
> -		count--;
> 
> 	while (count--) {
> 		if (i==0)
> -			i += tx_ring->count;
> +			i = tx_ring->count;
> 		i--;
> 		buffer_info = &tx_ring->buffer_info[i];
> 		e1000_unmap_and_free_tx_resource(adapter, buffer_info);
> 	}
> 
> 	return 0;
> }

This affects the patches:
[PATCH] e1000: Fix tests of unsigned in e1000_tx_map()
and the other patch in the same thread.

Do you want me to send a delta patch?

Roel
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ