summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathan Lynch <ntl@pobox.com>2013-04-29 16:29:46 -0500
committerThomas Graf <tgraf@suug.ch>2013-05-08 13:48:24 +0200
commit8983fa99140297aa4a57b11b0222cf26c135bd00 (patch)
tree433642243dbc42c760e2d77e5fb50219223ecc74
parent183052d0474af6baf1d640dae94b85a23d886b9a (diff)
rtnl_link_af_unregister: fix locking
rtnl_link_af_unregister() attempts to write-lock info_lock twice instead of releasing it before returning. It also will return with info_lock write-locked if passed a NULL ops. Signed-off-by: Thomas Graf <tgraf@suug.ch>
-rw-r--r--lib/route/link/api.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/route/link/api.c b/lib/route/link/api.c
index 352bb83..6d1e12f 100644
--- a/lib/route/link/api.c
+++ b/lib/route/link/api.c
@@ -326,7 +326,7 @@ int rtnl_link_af_unregister(struct rtnl_link_af_ops *ops)
int err = -NLE_INVAL;
if (!ops)
- goto errout;
+ return err;
nl_write_lock(&info_lock);
if (!af_ops[ops->ao_family]) {
@@ -345,7 +345,7 @@ int rtnl_link_af_unregister(struct rtnl_link_af_ops *ops)
ops->ao_family);
errout:
- nl_write_lock(&info_lock);
+ nl_write_unlock(&info_lock);
return err;
}