|
@@ -1298,14 +1298,19 @@ err_table_hash_alloc:
|
|
|
|
|
|
static void ip_fib_net_exit(struct net *net)
|
|
static void ip_fib_net_exit(struct net *net)
|
|
{
|
|
{
|
|
- unsigned int i;
|
|
|
|
|
|
+ int i;
|
|
|
|
|
|
rtnl_lock();
|
|
rtnl_lock();
|
|
#ifdef CONFIG_IP_MULTIPLE_TABLES
|
|
#ifdef CONFIG_IP_MULTIPLE_TABLES
|
|
RCU_INIT_POINTER(net->ipv4.fib_main, NULL);
|
|
RCU_INIT_POINTER(net->ipv4.fib_main, NULL);
|
|
RCU_INIT_POINTER(net->ipv4.fib_default, NULL);
|
|
RCU_INIT_POINTER(net->ipv4.fib_default, NULL);
|
|
#endif
|
|
#endif
|
|
- for (i = 0; i < FIB_TABLE_HASHSZ; i++) {
|
|
|
|
|
|
+ /* Destroy the tables in reverse order to guarantee that the
|
|
|
|
+ * local table, ID 255, is destroyed before the main table, ID
|
|
|
|
+ * 254. This is necessary as the local table may contain
|
|
|
|
+ * references to data contained in the main table.
|
|
|
|
+ */
|
|
|
|
+ for (i = FIB_TABLE_HASHSZ - 1; i >= 0; i--) {
|
|
struct hlist_head *head = &net->ipv4.fib_table_hash[i];
|
|
struct hlist_head *head = &net->ipv4.fib_table_hash[i];
|
|
struct hlist_node *tmp;
|
|
struct hlist_node *tmp;
|
|
struct fib_table *tb;
|
|
struct fib_table *tb;
|