diff options
author | Jason Wang <jasowang@redhat.com> | 2015-03-12 01:57:44 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-03-12 14:37:17 -0400 |
commit | ab3971b1e7d72270a2a259a29c1a40351b889740 (patch) | |
tree | 7cc9dbee7275690f11a90c989196fe35b880930d /drivers/net/virtio_net.c | |
parent | f862e07cf95d5b62a5fc5e981dd7d0dbaf33a501 (diff) |
virtio-net: correctly delete napi hash
We don't delete napi from hash list during module exit. This will
cause the following panic when doing module load and unload:
BUG: unable to handle kernel paging request at 0000004e00000075
IP: [<ffffffff816bd01b>] napi_hash_add+0x6b/0xf0
PGD 3c5d5067 PUD 0
Oops: 0000 [#1] SMP
...
Call Trace:
[<ffffffffa0a5bfb7>] init_vqs+0x107/0x490 [virtio_net]
[<ffffffffa0a5c9f2>] virtnet_probe+0x562/0x791815639d880be [virtio_net]
[<ffffffff8139e667>] virtio_dev_probe+0x137/0x200
[<ffffffff814c7f2a>] driver_probe_device+0x7a/0x250
[<ffffffff814c81d3>] __driver_attach+0x93/0xa0
[<ffffffff814c8140>] ? __device_attach+0x40/0x40
[<ffffffff814c6053>] bus_for_each_dev+0x63/0xa0
[<ffffffff814c7a79>] driver_attach+0x19/0x20
[<ffffffff814c76f0>] bus_add_driver+0x170/0x220
[<ffffffffa0a60000>] ? 0xffffffffa0a60000
[<ffffffff814c894f>] driver_register+0x5f/0xf0
[<ffffffff8139e41b>] register_virtio_driver+0x1b/0x30
[<ffffffffa0a60010>] virtio_net_driver_init+0x10/0x12 [virtio_net]
This patch fixes this by doing this in virtnet_free_queues(). And also
don't delete napi in virtnet_freeze() since it will call
virtnet_free_queues() which has already did this.
Fixes 91815639d880 ("virtio-net: rx busy polling support")
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/virtio_net.c')
-rw-r--r-- | drivers/net/virtio_net.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index f1ff3666f090..59b0e9754ae3 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c | |||
@@ -1448,8 +1448,10 @@ static void virtnet_free_queues(struct virtnet_info *vi) | |||
1448 | { | 1448 | { |
1449 | int i; | 1449 | int i; |
1450 | 1450 | ||
1451 | for (i = 0; i < vi->max_queue_pairs; i++) | 1451 | for (i = 0; i < vi->max_queue_pairs; i++) { |
1452 | napi_hash_del(&vi->rq[i].napi); | ||
1452 | netif_napi_del(&vi->rq[i].napi); | 1453 | netif_napi_del(&vi->rq[i].napi); |
1454 | } | ||
1453 | 1455 | ||
1454 | kfree(vi->rq); | 1456 | kfree(vi->rq); |
1455 | kfree(vi->sq); | 1457 | kfree(vi->sq); |
@@ -1948,11 +1950,8 @@ static int virtnet_freeze(struct virtio_device *vdev) | |||
1948 | cancel_delayed_work_sync(&vi->refill); | 1950 | cancel_delayed_work_sync(&vi->refill); |
1949 | 1951 | ||
1950 | if (netif_running(vi->dev)) { | 1952 | if (netif_running(vi->dev)) { |
1951 | for (i = 0; i < vi->max_queue_pairs; i++) { | 1953 | for (i = 0; i < vi->max_queue_pairs; i++) |
1952 | napi_disable(&vi->rq[i].napi); | 1954 | napi_disable(&vi->rq[i].napi); |
1953 | napi_hash_del(&vi->rq[i].napi); | ||
1954 | netif_napi_del(&vi->rq[i].napi); | ||
1955 | } | ||
1956 | } | 1955 | } |
1957 | 1956 | ||
1958 | remove_vq_common(vi); | 1957 | remove_vq_common(vi); |