netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Jeongjun Park <aha310510@gmail.com>
Cc: jiri@resnulli.us, davem@davemloft.net, edumazet@google.com,
	pabeni@redhat.com, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	syzbot+b668da2bc4cb9670bf58@syzkaller.appspotmail.com
Subject: Re: [PATCH net] team: fix possible deadlock in team_port_change_check
Date: Thu, 1 Aug 2024 07:28:42 -0700	[thread overview]
Message-ID: <20240801072842.69b0cc57@kernel.org> (raw)
In-Reply-To: <20240801111842.50031-1-aha310510@gmail.com>

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

  reply	other threads:[~2024-08-01 14:28 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-01 11:18 [PATCH net] team: fix possible deadlock in team_port_change_check Jeongjun Park
2024-08-01 14:28 ` Jakub Kicinski [this message]
2024-08-01 22:51   ` Jeongjun Park
2024-08-02  0:49     ` Jakub Kicinski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240801072842.69b0cc57@kernel.org \
    --to=kuba@kernel.org \
    --cc=aha310510@gmail.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=jiri@resnulli.us \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=syzbot+b668da2bc4cb9670bf58@syzkaller.appspotmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).