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 @@ -261,6 +261,17 @@ static void __team_option_inst_mark_removed_port(struct team *team,
261
261
}
262
262
}
263
263
264
+ static bool __team_option_inst_tmp_find (const struct list_head * opts ,
265
+ const struct team_option_inst * needle )
266
+ {
267
+ struct team_option_inst * opt_inst ;
268
+
269
+ list_for_each_entry (opt_inst , opts , tmp_list )
270
+ if (opt_inst == needle )
271
+ return true;
272
+ return false;
273
+ }
274
+
264
275
static int __team_options_register (struct team * team ,
265
276
const struct team_option * option ,
266
277
size_t option_count )
@@ -2561,6 +2572,14 @@ static int team_nl_cmd_options_set(struct sk_buff *skb, struct genl_info *info)
2561
2572
if (err )
2562
2573
goto team_put ;
2563
2574
opt_inst -> changed = true;
2575
+
2576
+ /* dumb/evil user-space can send us duplicate opt,
2577
+ * keep only the last one
2578
+ */
2579
+ if (__team_option_inst_tmp_find (& opt_inst_list ,
2580
+ opt_inst ))
2581
+ continue ;
2582
+
2564
2583
list_add (& opt_inst -> tmp_list , & opt_inst_list );
2565
2584
}
2566
2585
if (!opt_found ) {
You can’t perform that action at this time.
0 commit comments