diff options
author | John Fastabend <john.r.fastabend@intel.com> | 2010-11-16 14:42:53 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-11-18 12:41:40 -0500 |
commit | 7d8e76bf9ac3604897f0ce12e8bf09b68c2a2c89 (patch) | |
tree | c22856a3f630d3fb3067aa1a89f8f884f97dcc40 /net/core | |
parent | ef22b7b65f0eda9015becc7bff225a399914a242 (diff) |
net: zero kobject in rx_queue_release
netif_set_real_num_rx_queues() can decrement and increment
the number of rx queues. For example ixgbe does this as
features and offloads are toggled. Presumably this could
also happen across down/up on most devices if the available
resources changed (cpu offlined).
The kobject needs to be zero'd in this case so that the
state is not preserved across kobject_put()/kobject_init_and_add().
This resolves the following error report.
ixgbe 0000:03:00.0: eth2: NIC Link is Up 10 Gbps, Flow Control: RX/TX
kobject (ffff880324b83210): tried to init an initialized object, something is seriously wrong.
Pid: 1972, comm: lldpad Not tainted 2.6.37-rc18021qaz+ #169
Call Trace:
[<ffffffff8121c940>] kobject_init+0x3a/0x83
[<ffffffff8121cf77>] kobject_init_and_add+0x23/0x57
[<ffffffff8107b800>] ? mark_lock+0x21/0x267
[<ffffffff813c6d11>] net_rx_queue_update_kobjects+0x63/0xc6
[<ffffffff813b5e0e>] netif_set_real_num_rx_queues+0x5f/0x78
[<ffffffffa0261d49>] ixgbe_set_num_queues+0x1c6/0x1ca [ixgbe]
[<ffffffffa0262509>] ixgbe_init_interrupt_scheme+0x1e/0x79c [ixgbe]
[<ffffffffa0274596>] ixgbe_dcbnl_set_state+0x167/0x189 [ixgbe]
Signed-off-by: John Fastabend <john.r.fastabend@intel.com>
Acked-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core')
-rw-r--r-- | net/core/net-sysfs.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c index a5ff5a89f376..7f902cad10f8 100644 --- a/net/core/net-sysfs.c +++ b/net/core/net-sysfs.c | |||
@@ -712,15 +712,21 @@ static void rx_queue_release(struct kobject *kobj) | |||
712 | 712 | ||
713 | 713 | ||
714 | map = rcu_dereference_raw(queue->rps_map); | 714 | map = rcu_dereference_raw(queue->rps_map); |
715 | if (map) | 715 | if (map) { |
716 | RCU_INIT_POINTER(queue->rps_map, NULL); | ||
716 | call_rcu(&map->rcu, rps_map_release); | 717 | call_rcu(&map->rcu, rps_map_release); |
718 | } | ||
717 | 719 | ||
718 | flow_table = rcu_dereference_raw(queue->rps_flow_table); | 720 | flow_table = rcu_dereference_raw(queue->rps_flow_table); |
719 | if (flow_table) | 721 | if (flow_table) { |
722 | RCU_INIT_POINTER(queue->rps_flow_table, NULL); | ||
720 | call_rcu(&flow_table->rcu, rps_dev_flow_table_release); | 723 | call_rcu(&flow_table->rcu, rps_dev_flow_table_release); |
724 | } | ||
721 | 725 | ||
722 | if (atomic_dec_and_test(&first->count)) | 726 | if (atomic_dec_and_test(&first->count)) |
723 | kfree(first); | 727 | kfree(first); |
728 | else | ||
729 | memset(kobj, 0, sizeof(*kobj)); | ||
724 | } | 730 | } |
725 | 731 | ||
726 | static struct kobj_type rx_queue_ktype = { | 732 | static struct kobj_type rx_queue_ktype = { |