forked from mirrors/linux
		
	net: dsa: warn if port lists aren't empty in dsa_port_teardown
There has been recent work towards matching each switchdev object addition with a corresponding deletion. Therefore, having elements in the fdbs, mdbs, vlans lists at the time of a shared (DSA, CPU) port's teardown is indicative of a bug somewhere else, and not something that is to be expected. We shouldn't try to silently paper over that. Instead, print a warning and a stack trace. This change is a prerequisite for moving the initialization/teardown of these lists. Make it clear that clearing the lists isn't needed. Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
		
							parent
							
								
									ce7ec1b8ec
								
							
						
					
					
						commit
						0832cd9f1f
					
				
					 1 changed files with 3 additions and 16 deletions
				
			
		| 
						 | 
					@ -568,9 +568,7 @@ static void dsa_port_teardown(struct dsa_port *dp)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct devlink_port *dlp = &dp->devlink_port;
 | 
						struct devlink_port *dlp = &dp->devlink_port;
 | 
				
			||||||
	struct dsa_switch *ds = dp->ds;
 | 
						struct dsa_switch *ds = dp->ds;
 | 
				
			||||||
	struct dsa_mac_addr *a, *tmp;
 | 
					 | 
				
			||||||
	struct net_device *slave;
 | 
						struct net_device *slave;
 | 
				
			||||||
	struct dsa_vlan *v, *n;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!dp->setup)
 | 
						if (!dp->setup)
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
| 
						 | 
					@ -601,20 +599,9 @@ static void dsa_port_teardown(struct dsa_port *dp)
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	list_for_each_entry_safe(a, tmp, &dp->fdbs, list) {
 | 
						WARN_ON(!list_empty(&dp->fdbs));
 | 
				
			||||||
		list_del(&a->list);
 | 
						WARN_ON(!list_empty(&dp->mdbs));
 | 
				
			||||||
		kfree(a);
 | 
						WARN_ON(!list_empty(&dp->vlans));
 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	list_for_each_entry_safe(a, tmp, &dp->mdbs, list) {
 | 
					 | 
				
			||||||
		list_del(&a->list);
 | 
					 | 
				
			||||||
		kfree(a);
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	list_for_each_entry_safe(v, n, &dp->vlans, list) {
 | 
					 | 
				
			||||||
		list_del(&v->list);
 | 
					 | 
				
			||||||
		kfree(v);
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	dp->setup = false;
 | 
						dp->setup = false;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue