[Devel] [PATCH 2/2] venet: do not leave destructor, if stats is NULL

Stanislav Kinsburskiy skinsbursky at virtuozzo.com
Tue Jul 25 11:39:51 MSK 2017


1) It can't happen
2) Device has to be freed anyways

Signed-off-by: Stanislav Kinsburskiy <skinsbursky at virtuozzo.com>
---
 drivers/net/venetdev.c |    7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/net/venetdev.c b/drivers/net/venetdev.c
index 5ac62c5..5710792 100644
--- a/drivers/net/venetdev.c
+++ b/drivers/net/venetdev.c
@@ -458,15 +458,12 @@ EXPORT_SYMBOL(venet_free_stat);
 static void venet_destructor(struct net_device *dev)
 {
 	struct venet_stats *stats = (struct venet_stats *)dev->ml_priv;
-	if (stats == NULL)
-		return;
-	free_percpu(stats->real_stats);
-	kfree(stats);
-	dev->ml_priv = NULL;
 
 	if (venet_free_stat)
 		venet_free_stat(dev->nd_net->owner_ve);
 
+	free_percpu(stats->real_stats);
+	kfree(stats);
 	free_netdev(dev);
 }
 



More information about the Devel mailing list