mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 10:40:15 +02:00 
			
		
		
		
	net/sched: cls_flower: Reject duplicated rules also under skip_sw
Currently, duplicated rules are rejected only for skip_hw or "none", hence allowing users to push duplicates into HW for no reason. Use the flower tables to protect for that. Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com> Signed-off-by: Paul Blakey <paulb@mellanox.com> Reported-by: Chris Mi <chrism@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
		
							parent
							
								
									d4b60e94e9
								
							
						
					
					
						commit
						35cc3cefc4
					
				
					 1 changed files with 10 additions and 13 deletions
				
			
		| 
						 | 
					@ -1238,7 +1238,6 @@ static int fl_change(struct net *net, struct sk_buff *in_skb,
 | 
				
			||||||
	if (err)
 | 
						if (err)
 | 
				
			||||||
		goto errout_idr;
 | 
							goto errout_idr;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!tc_skip_sw(fnew->flags)) {
 | 
					 | 
				
			||||||
	if (!fold && fl_lookup(fnew->mask, &fnew->mkey)) {
 | 
						if (!fold && fl_lookup(fnew->mask, &fnew->mkey)) {
 | 
				
			||||||
		err = -EEXIST;
 | 
							err = -EEXIST;
 | 
				
			||||||
		goto errout_mask;
 | 
							goto errout_mask;
 | 
				
			||||||
| 
						 | 
					@ -1248,7 +1247,6 @@ static int fl_change(struct net *net, struct sk_buff *in_skb,
 | 
				
			||||||
				     fnew->mask->filter_ht_params);
 | 
									     fnew->mask->filter_ht_params);
 | 
				
			||||||
	if (err)
 | 
						if (err)
 | 
				
			||||||
		goto errout_mask;
 | 
							goto errout_mask;
 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!tc_skip_hw(fnew->flags)) {
 | 
						if (!tc_skip_hw(fnew->flags)) {
 | 
				
			||||||
		err = fl_hw_replace_filter(tp, fnew, extack);
 | 
							err = fl_hw_replace_filter(tp, fnew, extack);
 | 
				
			||||||
| 
						 | 
					@ -1303,7 +1301,6 @@ static int fl_delete(struct tcf_proto *tp, void *arg, bool *last,
 | 
				
			||||||
	struct cls_fl_head *head = rtnl_dereference(tp->root);
 | 
						struct cls_fl_head *head = rtnl_dereference(tp->root);
 | 
				
			||||||
	struct cls_fl_filter *f = arg;
 | 
						struct cls_fl_filter *f = arg;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!tc_skip_sw(f->flags))
 | 
					 | 
				
			||||||
	rhashtable_remove_fast(&f->mask->ht, &f->ht_node,
 | 
						rhashtable_remove_fast(&f->mask->ht, &f->ht_node,
 | 
				
			||||||
			       f->mask->filter_ht_params);
 | 
								       f->mask->filter_ht_params);
 | 
				
			||||||
	__fl_delete(tp, f, extack);
 | 
						__fl_delete(tp, f, extack);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue