[Devel] [PATCH RHEL7 COMMIT] ms/lockd: double unregister of inetaddr notifiers

Konstantin Khorenko khorenko at virtuozzo.com
Wed Jul 4 18:44:28 MSK 2018


The commit is pushed to "branch-rh7-3.10.0-862.3.2.vz7.61.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-862.3.2.vz7.61.12
------>
commit 9179dc2df2cdba9f9974d14f63581b52b2651a4b
Author: Vasily Averin <vvs at virtuozzo.com>
Date:   Fri Oct 20 17:33:18 2017 +0300

    ms/lockd: double unregister of inetaddr notifiers
    
    lockd_up() can call lockd_unregister_notifiers twice:
    inside lockd_start_svc() when it calls lockd_svc_exit_thread()
    and then in error path of lockd_up()
    
    Patch forces lockd_start_svc() to unregister notifiers in all error cases
    and removes extra unregister in error path of lockd_up().
    
    Fixes: cb7d224f82e4 "lockd: unregister notifier blocks if the service ..."
    Signed-off-by: Vasily Averin <vvs at virtuozzo.com>
    Cc: stable at vger.kernel.org
    Reviewed-by: Jeff Layton <jlayton at kernel.org>
    Signed-off-by: J. Bruce Fields <bfields at redhat.com>
    
    This patch fixes a potential problem, found while investigating
    https://jira.sw.ru/browse/PSBM-86390
    
    (cherry picked from commit dc3033e16c59a2c4e62b31341258a5786cbcee56)
    Signed-off-by: Vasily Averin <vvs at virtuozzo.com>
---
 fs/lockd/svc.c | 20 +++++++++-----------
 1 file changed, 9 insertions(+), 11 deletions(-)

diff --git a/fs/lockd/svc.c b/fs/lockd/svc.c
index d2cffb3bbec3..df69095c02dd 100644
--- a/fs/lockd/svc.c
+++ b/fs/lockd/svc.c
@@ -381,6 +381,7 @@ static int lockd_start_svc(struct svc_serv *serv)
 		printk(KERN_WARNING
 			"lockd_up: svc_rqst allocation failed, error=%d\n",
 			error);
+		lockd_unregister_notifiers();
 		goto out_rqst;
 	}
 
@@ -472,13 +473,16 @@ int lockd_up(struct net *net)
 	}
 
 	error = lockd_up_net(serv, net);
-	if (error < 0)
-		goto err_net;
+	if (error < 0) {
+		lockd_unregister_notifiers();
+		goto err_put;
+	}
 
 	error = lockd_start_svc(serv);
-	if (error < 0)
-		goto err_start;
-
+	if (error < 0) {
+		lockd_down_net(serv, net);
+		goto err_put;
+	}
 	nlmsvc_users++;
 	/*
 	 * Note: svc_serv structures have an initial use count of 1,
@@ -489,12 +493,6 @@ int lockd_up(struct net *net)
 err_create:
 	mutex_unlock(&nlmsvc_mutex);
 	return error;
-
-err_start:
-	lockd_down_net(serv, net);
-err_net:
-	lockd_unregister_notifiers();
-	goto err_put;
 }
 EXPORT_SYMBOL_GPL(lockd_up);
 


More information about the Devel mailing list