File tree 1 file changed +19
-0
lines changed 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 )
@@ -2568,6 +2579,14 @@ static int team_nl_cmd_options_set(struct sk_buff *skb, struct genl_info *info)
2568
2579
if (err )
2569
2580
goto team_put ;
2570
2581
opt_inst -> changed = true;
2582
+
2583
+ /* dumb/evil user-space can send us duplicate opt,
2584
+ * keep only the last one
2585
+ */
2586
+ if (__team_option_inst_tmp_find (& opt_inst_list ,
2587
+ opt_inst ))
2588
+ continue ;
2589
+
2571
2590
list_add (& opt_inst -> tmp_list , & opt_inst_list );
2572
2591
}
2573
2592
if (!opt_found ) {
You can’t perform that action at this time.
0 commit comments