[Devel] [PATCH RHEL7 COMMIT] venet: do not leave destructor, if stats is NULL

Konstantin Khorenko khorenko at virtuozzo.com
Tue Jul 25 17:36:13 MSK 2017


The commit is pushed to "branch-rh7-3.10.0-514.26.1.vz7.33.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-514.26.1.vz7.33.16
------>
commit e45dc2d028f6014a571f3c23d0ed1481d110bab0
Author: Stanislav Kinsburskiy <skinsbursky at virtuozzo.com>
Date:   Tue Jul 25 18:36:13 2017 +0400

    venet: do not leave destructor, if stats is NULL
    
    1) It can't happen
    2) Device has to be freed anyways
    
    Found in the scope of https://jira.sw.ru/browse/PSBM-65033
    
    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