Fix panic in virtnet_remove
Subsystems (3)
PATCH 1/1 Fix panic in virtnet_remove
modprobe -r virtio_net panics in free_netdev() as the dev is already freed in the newly introduced virtnet_free (commit 3fa2a1df9094). Since virtnet_remove doesn't require dev after unregister, I am removing the free_netdev call in virtnet_remove instead of in virtnet_free (which seems to be the right place to free the dev). Confirmed that the panic is fixed with this patch.
--- drivers/net/virtio_net.c | 2 -- 1 file changed, 2 deletions(-)
drivers/net/virtio_net.c +0 -2
@@ -1121,8 +1121,6 @@ static void __devexit virtnet_remove(strwhile (vi->pages)__free_pages (get_a_page (vi,GFP_KERNEL ),0 ); - -free_netdev (vi->dev); }static struct virtio_device_id id_table[] = {
David Miller
maintainerFrom: Krishna Kumar <[email protected]>
Date: Fri, 15 Jul 2011 14:46:50 +0530
Quoted 9 lines
modprobe -r
virtio_netpanics infree_netdev()as the dev is already freed in the newly introducedvirtnet_free(commit3fa2a1df9094). Sincevirtnet_removedoesn't require dev after unregister, I am removing thefree_netdevcall invirtnet_removeinstead of invirtnet_free(which seems to be the right place to free the dev). Confirmed that the panic is fixed with this patch.Signed-off-by Krishna Kumar <[email protected]>
I guess the virtio NET maintainers don't deserve to get CC:'d on a fix like this? :-(
Michael Tsirkin is who maintains this driver actively and is the one who will merge this kind of fix to me, therefore if you don't CC:
him it might not get integrated at all.
David Miller <[email protected]> wrote on 07/15/2011 08:49:09 PM:
Quoted 8 lines
Quoted 8 lines
modprobe -r
virtio_netpanics infree_netdev()as the dev is already freed in the newly introducedvirtnet_free(commit3fa2a1df9094). Sincevirtnet_removedoesn't require dev after unregister, I am removing thefree_netdevcall invirtnet_removeinstead of invirtnet_free(which seems to be the right place to free the dev). Confirmed that the panic is fixed with this patch.
Quoted 8 lines
Quoted 1 line
Signed-off-by Krishna Kumar <[email protected]>I guess the virtio NET maintainers don't deserve to get CC:'d on a fix like this? :-(
Michael Tsirkin is who maintains this driver actively and is the one who will merge this kind of fix to me, therefore if you don't CC:
him it might not get integrated at all.
Sorry, but it was not intentional. I saw that Stephen had made that change so cc'd him instead.
Michael, I am attaching the patch below, please let me know if you need it inlined:
(See attached file: patch)
Thanks,
- KK
Michael S. Tsirkin
maintainerQuoted 3 lines · Krishna Kumar
modprobe -r
virtio_netpanics infree_netdev()as the dev is already freed in the newly introducedvirtnet_free(commit3fa2a1df9094).
Good catch, thanks!
Quoted 2 lines
Since
virtnet_removedoesn't require
dev after unregister,
I'm not sure that true: vi used just above the line you remove is I think the struct virtnet_info that is allocated as part of that structure.
Quoted 4 lines
I am removing the
free_netdevcall
invirtnet_removeinstead of invirtnet_free(which seems to be the right place to free the dev). Confirmed that the panic is fixed with this patch.
This might be just because the memory isn't reused.
Try enabling slab poisoning, I think you'll observe some problems.
Do we absolutely have to have a destructor?
Can't we move the per cpu counter free fromvirtnet_free to virtnet_remove, and get rid ofvirtnet_free completely?
Quoted 21 lines
Signed-off-by Krishna Kumar <[email protected]>--- drivers/net/virtio_net.c | 2 -- 1 file changed, 2 deletions(-)diff -ruNp
org/drivers/net/virtio_net.cnew/drivers/net/virtio_net.cdrivers/net/virtio_net.c +0
-3@@ -1121,8 +1121,6 @@ static void __devexit virtnet_remove(strwhile (vi->pages)__free_pages (get_a_page (vi,GFP_KERNEL ),0 ); - -free_netdev (vi->dev); }static struct virtio_device_id id_table[] = { --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