All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Lezcano <dlezcano-NmTC/0ZBporQT0dZR+AlfA@public.gmane.org>
To: Brian Haley <brian.haley-VXdhtT5mjnY@public.gmane.org>
Cc: containers-qjLDD68F18O7TbgM5vRIOg@public.gmane.org,
	Benjamin Thery <benjamin.thery-6ktuUTfB/bM@public.gmane.org>,
	xemul-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org,
	ebiederm-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org,
	den-3ImXcnM4P+0@public.gmane.org
Subject: Re: [patch 12/38][IPV6] ip6_fib - move the fib table to the network namespace
Date: Wed, 05 Dec 2007 11:05:00 +0100	[thread overview]
Message-ID: <475677CC.2040201@fr.ibm.com> (raw)
In-Reply-To: <4755AA47.3000501-VXdhtT5mjnY@public.gmane.org>

Brian Haley wrote:
> Hi Daniel,
> 
> Daniel Lezcano wrote:
>> Move the global definition of the fib table to the network namespace
>> structure and make their access to the initial network namespace.
> ....
>> -void __init fib6_init(void)
>> +static int fib6_net_init(struct net *net)
>>  {
>> -    fib6_node_kmem = kmem_cache_create("fib6_nodes",
>> -                       sizeof(struct fib6_node),
>> -                       0, SLAB_HWCACHE_ALIGN|SLAB_PANIC,
>> -                       NULL);
>> +    int ret;
>>  
>> -    fib_table_hash = 
>> kzalloc(sizeof(*fib_table_hash)*FIB_TABLE_HASHSZ, GFP_KERNEL);
>> -    if (!fib_table_hash)
>> -        panic("IPV6: Failed to allocate fib_table_hash.\n");
>> -
>> -    fib6_main_tbl = kzalloc(sizeof(*fib6_main_tbl), GFP_KERNEL);
>> -    if (!fib6_main_tbl)
>> -        panic("IPV6: Failed to allocate fib6_main_tbl.\n");
>> -
>> -    fib6_main_tbl->tb6_id = RT6_TABLE_MAIN;
>> -    fib6_main_tbl->tb6_root.leaf = &ip6_null_entry;
>> -    fib6_main_tbl->tb6_root.fn_flags = RTN_ROOT | RTN_TL_ROOT | 
>> RTN_RTINFO;
>> +    if (net != &init_net)
>> +        return -EPERM;
>> +
>> +    ret = -ENOMEM;
>> +    net->fib_table_hash = 
>> kzalloc(sizeof(*net->fib_table_hash)*FIB_TABLE_HASHSZ,
>> +                      GFP_KERNEL);
>> +    if (!net->fib_table_hash)
>> +        goto out;
> 
> So originally, the fib_table_hash was global with no allocation 
> necessary.  Then in patch 11 you changed it to be dynamic and panic() on 
> failure.  Now it just gracefully returns.  Do you really want to do that 
> for the init_net namespace?  Won't the next routine that tries to access 
> this NULL pointer oops?  Same for fib6_main_table, fib6_local_table, 
> fib6_stats, etc.  Or did I miss where the callers error-out on an ENOMEM?

Yes, you are right, this is not consistent and we should not panic 
neither ignore the error. I should have modified the ip6_route_init and 
returned an error in case of register_pernet_subsys failure. So the ipv6 
initialization can fails safely.

I will post some modifications around that for net-2.6.25 for netdev@.

Thanks for catching that.

	-- Daniel

  parent reply	other threads:[~2007-12-05 10:05 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-03 16:16 [patch 00/38][IPV6] ipv6 per network namespace Daniel Lezcano
2007-12-03 16:16 ` [patch 01/38][IPV6] net-2.6.25 - make netns cleanup to run in a separate queue Daniel Lezcano
2007-12-03 16:16 ` [patch 02/38][IPV6] Makefile - Activate netns configuration when sysctl is off Daniel Lezcano
2007-12-03 16:16 ` [patch 03/38][IPV6] inet6_addr - isolate inet6 addresses from proc file Daniel Lezcano
2007-12-03 16:16 ` [patch 04/38][IPV6] inet6_addr - check ipv6 address per namespace Daniel Lezcano
2007-12-03 16:16 ` [patch 05/38][IPV6] inet6_addr - make use of the new ipv6_chk_addr function Daniel Lezcano
2007-12-03 16:16 ` [patch 06/38][IPV6] inet6_addr - ipv6_chk_same_addr namespace aware Daniel Lezcano
2007-12-03 16:16 ` [patch 07/38][IPV6] inet6_addr - ipv6_get_ifaddr " Daniel Lezcano
2007-12-03 16:16 ` [patch 08/38][IPV6] inet6_addr - remove ipv6_get_ifaddr wrapper Daniel Lezcano
2007-12-03 16:16 ` [patch 09/38][IPV6] inet6_addr - make ipv6_chk_home_addr namespace aware Daniel Lezcano
2007-12-03 16:16 ` [patch 10/38][IPV6] ip6_fib - make mindless changes Daniel Lezcano
2007-12-03 16:16 ` [patch 11/38][IPV6] ip6_fib - dynamically allocate fib tables Daniel Lezcano
2007-12-03 16:16 ` [patch 12/38][IPV6] ip6_fib - move the fib table to the network namespace Daniel Lezcano
     [not found]   ` <20071203162453.368428873-WECHFHqYCmGD/CxQmPlnQ0FT0OZdM7KVQQ4Iyu8u01E@public.gmane.org>
2007-12-04 19:28     ` Brian Haley
     [not found]       ` <4755AA47.3000501-VXdhtT5mjnY@public.gmane.org>
2007-12-05 10:05         ` Daniel Lezcano [this message]
2007-12-03 16:16 ` [patch 13/38][IPV6] ip6_fib - make the fib table per " Daniel Lezcano
2007-12-03 16:16 ` [patch 14/38][IPV6] ip6_fib - make fib6_clean_all per namespace Daniel Lezcano
2007-12-03 16:16 ` [patch 15/38][IPV6] ip6_fib - pass the network namespace parameter to timer callback Daniel Lezcano
2007-12-03 16:16 ` [patch 16/38][IPV6] ip6_fib - make ip6 fib gc timer mindless changes Daniel Lezcano
2007-12-03 16:16 ` [patch 17/38][IPV6] ip6_fib - dynamically allocate the ip6 fib gc timer Daniel Lezcano
2007-12-03 16:16 ` [patch 18/38][IPV6] ip6_fib - move the ip6 fib gc timer to the network namespace Daniel Lezcano
2007-12-03 16:16 ` [patch 19/38][IPV6] ip6_fib - make the ip6 fib gc timer handle several network namespaces Daniel Lezcano
2007-12-03 16:16 ` [patch 20/38][IPV6] fib6_rules - make fib_rules per network namespace Daniel Lezcano
2007-12-03 16:16 ` [patch 21/38][IPV6] rt6_stats - make mindless changes for rt6_stats Daniel Lezcano
2007-12-03 16:16 ` [patch 22/38][IPV6] rt6_stats - dynamically allocate the rt6_stats Daniel Lezcano
2007-12-03 16:16 ` [patch 23/38][IPV6] rt6_stats - make the rt6_stats relative to the namespace Daniel Lezcano
2007-12-03 16:17 ` [patch 24/38][IPV6] rt6_stats - make rt6_stats per namespace Daniel Lezcano
2007-12-03 16:17 ` [patch 25/38][IPV6] route6 - create route6 proc files for the namespace Daniel Lezcano
2007-12-03 16:17 ` [patch 26/38][IPV6] route6 - Pass the network namespace parameter to rt6_lookup Daniel Lezcano
2007-12-03 16:17 ` [patch 27/38][IPV6] route6 - Make proc entry /proc/net/rt6_stats per namespace Daniel Lezcano
2007-12-03 16:17 ` [patch 28/38][IPV6] route6 - Pass network namespace to rt6_add_route_info and rt6_get_route_info Daniel Lezcano
2007-12-03 16:17 ` [patch 29/38][IPV6] route6 - Pass the network namespace parameter to rt6_purge_dflt_routers Daniel Lezcano
2007-12-03 16:17 ` [patch 30/38][IPV6] route6 - make route6 per namespace Daniel Lezcano
2007-12-03 16:17 ` [patch 31/38][IPV6] rt6_info - make rt6_info accessed as a pointer Daniel Lezcano
2007-12-03 16:17 ` [patch 32/38][IPV6] rt6_info - dynamically allocate rt6_info Daniel Lezcano
2007-12-03 16:17 ` [patch 33/38][IPV6] rt6_info - move rt6_info structure inside the namespace Daniel Lezcano
2007-12-03 16:17 ` [patch 34/38][IPV6] addrconf - Pass the proper network namespace parameters to addrconf Daniel Lezcano
2007-12-03 16:17 ` [patch 35/38][IPV6] addrconf - Add a network namespace parameter to addrconf_forward_change Daniel Lezcano
2007-12-03 16:17 ` [patch 36/38][IPV6] addrconf - make addrconf per namespace Daniel Lezcano
2007-12-03 16:17 ` [patch 37/38][IPV6] ndisc - dynamically allocate default neigh_parms for ndisc Daniel Lezcano
2007-12-03 16:17 ` [patch 38/38][IPV6] ndisc - make ndisc handle multiple network namespaces Daniel Lezcano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=475677CC.2040201@fr.ibm.com \
    --to=dlezcano-nmtc/0zbporqt0dzr+alfa@public.gmane.org \
    --cc=benjamin.thery-6ktuUTfB/bM@public.gmane.org \
    --cc=brian.haley-VXdhtT5mjnY@public.gmane.org \
    --cc=containers-qjLDD68F18O7TbgM5vRIOg@public.gmane.org \
    --cc=den-3ImXcnM4P+0@public.gmane.org \
    --cc=ebiederm-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org \
    --cc=xemul-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.