# Re: \[PATCH\] netns: fix net\_alloc\_generic()

- From: David Miller \<davem@davemloft.net\>
- Date: 2012-01-26 18:37:34 
- List: netdev
- Page: https://ratatoskr.run/netdev/2012/01/3814091
- Thread: https://ratatoskr.run/netdev/2012/01/3813612/t.md

```text
From: Eric Dumazet <redacted>
Date: Thu, 26 Jan 2012 11:41:38 +0100

> [PATCH] netns: fix net_alloc_generic()
> 
> When a new net namespace is created, we should attach to it a "struct
> net_generic" with enough slots (even empty), or we can hit the following
> BUG_ON() :
> 
...
> net_alloc_generic() should take into account the maximum index into the
> ptr array, as a subsystem might use net_generic() anytime.
> 
> This also reduces number of reallocations in net_assign_generic()
> 
> Reported-by: Sasha Levin <redacted>
> Signed-off-by: Eric Dumazet <redacted>

Applied and queued up for -stable, thanks.
```
