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: <C752C323.1B021%scofeldm@cisco.com>
Date:	Sat, 19 Dec 2009 17:51:31 -0800
From:	Scott Feldman <scofeldm@...co.com>
To:	Simon Horman <horms@...ge.net.au>
CC:	<davem@...emloft.net>, <netdev@...r.kernel.org>
Subject: Re: [net-next PATCH 2/6] enic: Bug fix: try harder to fill Rx ring on
 skb allocation failures

On 12/19/09 2:41 AM, "Simon Horman" <horms@...ge.net.au> wrote:

> On Fri, Dec 18, 2009 at 06:09:46PM -0800, Scott Feldman wrote:
>> for (i = 0; i < enic->rq_count; i++) {
>> -  err = vnic_rq_fill(&enic->rq[i], enic->rq_alloc_buf);
>> -  if (err) {
>> +  vnic_rq_fill(&enic->rq[i], enic->rq_alloc_buf);
>> +  /* Need at least one buffer on ring to get going */
>> +  if (vnic_rq_desc_used(&enic->rq[i]) == 0) {
>> printk(KERN_ERR PFX
>> "%s: Unable to alloc receive buffers.\n",
>> netdev->name);
>> +   err = -ENOMEM;
>> goto err_out_notify_unset;
>> }
>> }
> 
> Also, in the case where a failure occurs for i > 0,
> it it necessary to unwind the previous rq allocations?

Sorry Simon, I replied wrongly on this one.  The code only cares if _all_
allocations failed (i.e. The ring is empty), and takes the err path.  Since
nothing was allocated, the err path has nothing to cleanup.

If at lease one skb was allocated, then we don't go down the err path, even
if not all of the allocations succeeded.  Bottom line is we only need one
skb on the ring to get the ball rolling.  If we start out with a full
rings-worth of skbs (the expected case), then that's even better.

-scott

--
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