[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210126100257.GN3565223@nanopsycho.orion>
Date: Tue, 26 Jan 2021 11:02:57 +0100
From: Jiri Pirko <jiri@...nulli.us>
To: Ivan Vecera <ivecera@...hat.com>
Cc: netdev@...r.kernel.org, "David S . Miller" <davem@...emloft.net>,
Cong Wang <xiyou.wangcong@...il.com>,
Jakub Kicinski <kuba@...nel.org>,
Saeed Mahameed <saeed@...nel.org>
Subject: Re: [PATCH net] team: protect features update by RCU to avoid
deadlock
Mon, Jan 25, 2021 at 08:44:16AM CET, ivecera@...hat.com wrote:
>Function __team_compute_features() is protected by team->lock
>mutex when it is called from team_compute_features() used when
>features of an underlying device is changed. This causes
>a deadlock when NETDEV_FEAT_CHANGE notifier for underlying device
>is fired due to change propagated from team driver (e.g. MTU
>change). It's because callbacks like team_change_mtu() or
>team_vlan_rx_{add,del}_vid() protect their port list traversal
>by team->lock mutex.
>
>Example (r8169 case where this driver disables TSO for certain MTU
>values):
>...
>[ 6391.348202] __mutex_lock.isra.6+0x2d0/0x4a0
>[ 6391.358602] team_device_event+0x9d/0x160 [team]
>[ 6391.363756] notifier_call_chain+0x47/0x70
>[ 6391.368329] netdev_update_features+0x56/0x60
>[ 6391.373207] rtl8169_change_mtu+0x14/0x50 [r8169]
>[ 6391.378457] dev_set_mtu_ext+0xe1/0x1d0
>[ 6391.387022] dev_set_mtu+0x52/0x90
>[ 6391.390820] team_change_mtu+0x64/0xf0 [team]
>[ 6391.395683] dev_set_mtu_ext+0xe1/0x1d0
>[ 6391.399963] do_setlink+0x231/0xf50
>...
>
>In fact team_compute_features() called from team_device_event()
>does not need to be protected by team->lock mutex and rcu_read_lock()
>is sufficient there for port list traversal.
>
>Fixes: 3d249d4ca7d0 ("net: introduce ethernet teaming device")
>Cc: Jiri Pirko <jiri@...nulli.us>
>Cc: David S. Miller <davem@...emloft.net>
>Cc: Cong Wang <xiyou.wangcong@...il.com>
>Cc: Jakub Kicinski <kuba@...nel.org>
>Cc: Saeed Mahameed <saeed@...nel.org>
>Signed-off-by: Ivan Vecera <ivecera@...hat.com>
Reviewed-by: Jiri Pirko <jiri@...dia.com>
Powered by blists - more mailing lists