diff options
author | Nathan Lynch <ntl@pobox.com> | 2013-04-29 21:29:46 (GMT) |
---|---|---|
committer | Thomas Graf <tgraf@suug.ch> | 2013-05-08 11:48:24 (GMT) |
commit | 8983fa99140297aa4a57b11b0222cf26c135bd00 (patch) | |
tree | 433642243dbc42c760e2d77e5fb50219223ecc74 /lib | |
parent | 183052d0474af6baf1d640dae94b85a23d886b9a (diff) | |
download | libnl-8983fa99140297aa4a57b11b0222cf26c135bd00.zip libnl-8983fa99140297aa4a57b11b0222cf26c135bd00.tar.gz libnl-8983fa99140297aa4a57b11b0222cf26c135bd00.tar.bz2 |
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>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/route/link/api.c | 4 |
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; } |