From: Ying Xue <[email protected]>
Date: Mon, 1 Jan 2018 18:24:01 +0800
> diff --git a/net/tipc/netlink_compat.c b/net/tipc/netlink_compat.c
> index e48f0b2..0fb12a4 100644
> --- a/net/tipc/netlink_compat.c
> +++ b/net/tipc/netlink_compat.c
> @@ -720,17 +720,21 @@ static int tipc_nl_compat_link_set(struct
> tipc_nl_compat_cmd_doit *cmd,
>
> lc = (struct tipc_link_config *)TLV_DATA(msg->req);
>
> + rtnl_lock();
> media = tipc_media_find(lc->name);
> if (media) {
> cmd->doit = &tipc_nl_media_set;
> + rtnl_unlock();
> return tipc_nl_compat_media_set(skb, msg);
> }
>
> bearer = tipc_bearer_find(msg->net, lc->name);
> if (bearer) {
> cmd->doit = &tipc_nl_bearer_set;
> + rtnl_unlock();
> return tipc_nl_compat_bearer_set(skb, msg);
> }
> + rtnl_unlock();
>
> return __tipc_nl_compat_link_set(skb, msg);
> }
As soon as you drop the RTNL lock, the media or bearer entry can be
removed from the tables.
This invalidates what you do next, whether it's
tipc_nl_compat_media_set(), tipc_nl_compat_bearer_set(), etc.
Therefore, you have to lock down the tipc configuration state around
this entire operation, from media/bearer probe to the building of the
netlink message(s).
Either this entire code path must execute with the bearer/media entry
present, or without. If you drop the RTNL mutex in the middle, this
invariant is not held.
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
tipc-discussion mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tipc-discussion