tipc: context imbalance at node read unlock
authorParthasarathy Bhuvaragan <parthasarathy.bhuvaragan@ericsson.com>
Thu, 24 Aug 2017 14:31:24 +0000 (16:31 +0200)
committerDavid S. Miller <davem@davemloft.net>
Fri, 25 Aug 2017 04:54:34 +0000 (21:54 -0700)
If we fail to find a valid bearer in tipc_node_get_linkname(),
node_read_unlock() is called without holding the node read lock.

This commit fixes this error.

Signed-off-by: Parthasarathy Bhuvaragan <parthasarathy.bhuvaragan@ericsson.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/tipc/node.c

index b113a52f8914b34e28ef2639a6637b503f14c90d..7dd22330a6b4bf9113e189c613a863fce13425a2 100644 (file)
@@ -1126,8 +1126,8 @@ int tipc_node_get_linkname(struct net *net, u32 bearer_id, u32 addr,
                strncpy(linkname, tipc_link_name(link), len);
                err = 0;
        }
-exit:
        tipc_node_read_unlock(node);
+exit:
        tipc_node_put(node);
        return err;
 }