Subject: Re: [PATCH net] team: fix possible deadlock in team_port_change_check

From: Jakub Kicinski <[email-masked]>
Date: Thu, 1 Aug 2024 07:28:42 -0700

On Thu,  1 Aug 2024 20:18:42 +0900 Jeongjun Park wrote:
>  	struct team *team = port->team;
> +	bool flag = true;
>  
> -	mutex_lock(&team->lock);
> +	if (mutex_is_locked(&team->lock)){
> +		unsigned long owner, curr = (unsigned long)current;
> +		owner = atomic_long_read(&team->lock.owner);
> +		if (owner != curr)
> +			mutex_lock(&team->lock);
> +		else
> +			flag = false;
> +	}
> +	else{
> +		mutex_lock(&team->lock);
> +	}
>  	__team_port_change_check(port, linkup);
> -	mutex_unlock(&team->lock);
> +	if (flag)
> +		mutex_unlock(&team->lock);

You didn't even run this thru checkpatch, let alone the fact that its
reimplementing nested locks (or trying to) :(

Some of the syzbot reports are not fixed because they are either hard
or because there is a long standing disagreement on how to solve them.
Please keep that in mind.
-- 
pw-bot: cr