Comment 19 for bug 284377

Revision history for this message
TJ (tj) wrote : Re: [Bug 284377] Re: No NET with 2.6.27: No buffer space available

On Thu, 2009-03-26 at 23:04 +0000, arand wrote:
> Okay, I have gone through the debug procedure (correctly I hope, using
> Kow's sed commands), and the last bit indeed reads:
>
> (gdb) next
> 1021 if (r < 0) {
> 1: r = -1
> (gdb)
>
> So this would confirm your suspicions TJ?

Thank-you. Yes, it does indeed. The issue stems from a failed attempt by
the kernel to allocate memory. I'll repeat what I outlined earlier for
clarity since the original has a typo that gives a non-existent
file-name:

net/ipv4/devinet.c::devinet_ioctl()

 case SIOCSIFADDR: /* Set interface address (and family) */
  ret = -EINVAL;
  if (inet_abc_len(sin->sin_addr.s_addr) < 0)
   break;

  if (!ifa) {
   ret = -ENOBUFS;
   if ((ifa = inet_alloc_ifa()) == NULL)
    break;

The call to inet_alloc_ifa() is simply this:

static struct in_ifaddr *inet_alloc_ifa(void)
{
 struct in_ifaddr *ifa = kzalloc(sizeof(*ifa), GFP_KERNEL);

 if (ifa) {
  INIT_RCU_HEAD(&ifa->rcu_head);
 }

 return ifa;
}

So on the face of it this is a failure of kzalloc() to allocate a block
of zero-ed memory for the in_ifaddr structure although I can't see how
that would fail.

arand:

What kernel version did you do the test on? If possible, could you do
the same test with the latest Jaunty kernel? I want to be sure I'm
looking at the correct source-code whilst trying to figure this out.

Does the system have plenty of free memory (I know, long shot, but best
to be sure!) ?