From: Krishna Kumar <krkumar2@in.ibm.com>
To: Rusty Russell <rusty@rustcorp.com.au>,
"Michael S. Tsirkin" <mst@redhat.com>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
Krishna Kumar <krkumar2@in.ibm.com>,
virtualization@lists.linux-foundation.org
Subject: [PATCH repost] Fix panic in virtnet_remove
Date: Wed, 20 Jul 2011 19:26:02 +0530 [thread overview]
Message-ID: <20110720135602.18705.21405.sendpatchset@krkumar2.in.ibm.com> (raw)
Fix a panic in virtnet_remove. unregister_netdev has already
freed up the netdev (and virtnet_info) due to dev->destructor
being set, while virtnet_info is still required. Remove
virtnet_free altogether, and move the freeing of the per-cpu
statistics from virtnet_free to virtnet_remove.
Tested patch below.
Signed-off-by: Krishna Kumar <krkumar2@in.ibm.com>
---
(Michael suggested me to re-post with copy to all maintainers)
drivers/net/virtio_net.c | 10 +---------
1 file changed, 1 insertion(+), 9 deletions(-)
diff -ruNp org/drivers/net/virtio_net.c new/drivers/net/virtio_net.c
--- org/drivers/net/virtio_net.c 2011-07-18 09:14:02.000000000 +0530
+++ new/drivers/net/virtio_net.c 2011-07-18 09:16:35.000000000 +0530
@@ -705,14 +705,6 @@ static void virtnet_netpoll(struct net_d
}
#endif
-static void virtnet_free(struct net_device *dev)
-{
- struct virtnet_info *vi = netdev_priv(dev);
-
- free_percpu(vi->stats);
- free_netdev(dev);
-}
-
static int virtnet_open(struct net_device *dev)
{
struct virtnet_info *vi = netdev_priv(dev);
@@ -959,7 +951,6 @@ static int virtnet_probe(struct virtio_d
/* Set up network device as normal. */
dev->netdev_ops = &virtnet_netdev;
dev->features = NETIF_F_HIGHDMA;
- dev->destructor = virtnet_free;
SET_ETHTOOL_OPS(dev, &virtnet_ethtool_ops);
SET_NETDEV_DEV(dev, &vdev->dev);
@@ -1122,6 +1113,7 @@ static void __devexit virtnet_remove(str
while (vi->pages)
__free_pages(get_a_page(vi, GFP_KERNEL), 0);
+ free_percpu(vi->stats);
free_netdev(vi->dev);
}
next reply other threads:[~2011-07-20 13:56 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-20 13:56 Krishna Kumar [this message]
2011-07-20 14:31 ` [PATCH repost] Fix panic in virtnet_remove Michael S. Tsirkin
2011-07-22 4:29 ` David Miller
2011-07-22 4:29 ` David Miller
2011-07-20 14:31 ` Michael S. Tsirkin
-- strict thread matches above, loose matches on Subject: below --
2011-07-20 13:56 Krishna Kumar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20110720135602.18705.21405.sendpatchset@krkumar2.in.ibm.com \
--to=krkumar2@in.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mst@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=rusty@rustcorp.com.au \
--cc=virtualization@lists.linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.