diff options
author | Xin Long <lucien.xin@gmail.com> | 2019-04-01 16:15:24 +0800 |
---|---|---|
committer | Jiri Pirko <jiri@mellanox.com> | 2019-04-17 09:38:12 +0200 |
commit | 4dc3a7a042c88193f0371a33f1043919843e6447 (patch) | |
tree | b27ece0f00a0ee072ef66d178ee7879b0cc73756 | |
parent | 0f1b2fac03361c5d2bac34e4b19922c60c5c06c6 (diff) | |
download | libteam-4dc3a7a042c88193f0371a33f1043919843e6447.tar.gz |
teamd: tdport has to exist if item->per_port is set in __find_by_item_path
The issue can be reproduced by:
# teamd -c '{"device":"team0", "runner":{"name":"lacp"}}' &
# teamdctl team0 state item set runner.aggregator.selected true
teamd process will abort in lacp_port_state_aggregator_selected_set()
as gsc->info.tdport was set to NULL in teamd_state_item_value_set()
The item 'runner.aggregator.selected' is of per_port = true, and it
shouldn't allow to call its setter/getter().
This patch is to add the check for it in __find_by_item_path() called
by teamd_state_item_value_get/set().
Fixes: 6c00aaf02553 ("teamd: add support for state item write operation")
Signed-off-by: Xin Long <lucien.xin@gmail.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
-rw-r--r-- | teamd/teamd_state.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/teamd/teamd_state.c b/teamd/teamd_state.c index ab64db9..0714880 100644 --- a/teamd/teamd_state.c +++ b/teamd/teamd_state.c @@ -333,6 +333,7 @@ static int __find_by_item_path(struct teamd_state_val_item **p_item, list_for_each_node_entry(item, &ctx->state_val_list, list) { /* item->subpath[0] == '.' */ if (!strcmp(item->subpath + 1, subpath) && + (!item->per_port || tdport) && (!item->tdport || item->tdport == tdport)) { *p_item = item; *p_tdport = tdport; |