Re: [patch 6/6] ipv6 - route6/fib6 : dont panic a kmem_cache_create

2007-12-07 Thread David Miller
From: Daniel Lezcano [EMAIL PROTECTED]
Date: Thu, 06 Dec 2007 14:53:35 +0100

 If the kmem_cache_creation fails, the kernel will panic. It is acceptable
 if the system is booting, but if the ipv6 protocol is compiled as a module
 and it is loaded after the system has booted, do we want to panic instead
 of just failing to initialize the protocol ?
 
 The init function is now returning an error and this one is checked for
 protocol initialization. So the ipv6 protocol will safely fails.
 
 Signed-off-by: Daniel Lezcano [EMAIL PROTECTED]
 Acked-by: Benjamin Thery [EMAIL PROTECTED]

Also applied.
--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 6/6] ipv6 - route6/fib6 : dont panic a kmem_cache_create

2007-12-06 Thread Daniel Lezcano
If the kmem_cache_creation fails, the kernel will panic. It is acceptable
if the system is booting, but if the ipv6 protocol is compiled as a module
and it is loaded after the system has booted, do we want to panic instead
of just failing to initialize the protocol ?

The init function is now returning an error and this one is checked for
protocol initialization. So the ipv6 protocol will safely fails.

Signed-off-by: Daniel Lezcano [EMAIL PROTECTED]
Acked-by: Benjamin Thery [EMAIL PROTECTED]
---
 net/ipv6/ip6_fib.c |5 -
 net/ipv6/route.c   |5 -
 2 files changed, 8 insertions(+), 2 deletions(-)

Index: net-2.6.25/net/ipv6/ip6_fib.c
===
--- net-2.6.25.orig/net/ipv6/ip6_fib.c
+++ net-2.6.25/net/ipv6/ip6_fib.c
@@ -1478,8 +1478,11 @@ int __init fib6_init(void)
int ret;
fib6_node_kmem = kmem_cache_create(fib6_nodes,
   sizeof(struct fib6_node),
-  0, SLAB_HWCACHE_ALIGN|SLAB_PANIC,
+  0, SLAB_HWCACHE_ALIGN,
   NULL);
+   if (!fib6_node_kmem)
+   return -ENOMEM;
+
fib6_tables_init();
 
ret = __rtnl_register(PF_INET6, RTM_GETROUTE, NULL, inet6_dump_fib);
Index: net-2.6.25/net/ipv6/route.c
===
--- net-2.6.25.orig/net/ipv6/route.c
+++ net-2.6.25/net/ipv6/route.c
@@ -2466,7 +2466,10 @@ int __init ip6_route_init(void)
 
ip6_dst_ops.kmem_cachep =
kmem_cache_create(ip6_dst_cache, sizeof(struct rt6_info), 0,
- SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL);
+ SLAB_HWCACHE_ALIGN, NULL);
+   if (!ip6_dst_ops.kmem_cachep)
+   return -ENOMEM;
+
ip6_dst_blackhole_ops.kmem_cachep = ip6_dst_ops.kmem_cachep;
 
ret = fib6_init();

-- 
--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html