[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAO9qdTHJKMzOTRJB_N1VPjh2=Z=qLkpzu8eL5mcAr6hnFfiHXQ@mail.gmail.com>
Date: Fri, 2 Aug 2024 07:51:19 +0900
From: Jeongjun Park <aha310510@...il.com>
To: Jakub Kicinski <kuba@...nel.org>
Cc: jiri@...nulli.us, davem@...emloft.net, edumazet@...gle.com,
pabeni@...hat.com, netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
syzbot+b668da2bc4cb9670bf58@...kaller.appspotmail.com
Subject: Re: [PATCH net] team: fix possible deadlock in team_port_change_check
Jakub Kicinski wrote:
>
> 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.
Okay, but I have a question. Is it true that team devices can also be
protected through rtnl? As far as I know, rtnl only protects net_device,
so I didn't think about removing the lock for team->lock.
Regards,
Jeongjun Park
Powered by blists - more mailing lists