File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -253,6 +253,17 @@ static void __team_option_inst_mark_removed_port(struct team *team,
253253 }
254254}
255255
256+ static bool __team_option_inst_tmp_find (const struct list_head * opts ,
257+ const struct team_option_inst * needle )
258+ {
259+ struct team_option_inst * opt_inst ;
260+
261+ list_for_each_entry (opt_inst , opts , tmp_list )
262+ if (opt_inst == needle )
263+ return true;
264+ return false;
265+ }
266+
256267static int __team_options_register (struct team * team ,
257268 const struct team_option * option ,
258269 size_t option_count )
@@ -2520,6 +2531,14 @@ static int team_nl_cmd_options_set(struct sk_buff *skb, struct genl_info *info)
25202531 if (err )
25212532 goto team_put ;
25222533 opt_inst -> changed = true;
2534+
2535+ /* dumb/evil user-space can send us duplicate opt,
2536+ * keep only the last one
2537+ */
2538+ if (__team_option_inst_tmp_find (& opt_inst_list ,
2539+ opt_inst ))
2540+ continue ;
2541+
25232542 list_add (& opt_inst -> tmp_list , & opt_inst_list );
25242543 }
25252544 if (!opt_found ) {
You can’t perform that action at this time.
0 commit comments