[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CANn89iJLSmtBNoDo8QJ6a0MzsHjdLB0Pf=cs9e4g8Y6-KuFiMQ@mail.gmail.com>
Date: Tue, 20 Apr 2021 10:34:17 +0200
From: Eric Dumazet <edumazet@...gle.com>
To: AceLan Kao <acelan.kao@...onical.com>
Cc: "David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>,
Alexei Starovoitov <ast@...nel.org>,
Andrii Nakryiko <andriin@...com>, Wei Wang <weiwan@...gle.com>,
Cong Wang <cong.wang@...edance.com>,
Taehee Yoo <ap420073@...il.com>,
Björn Töpel <bjorn@...nel.org>,
netdev <netdev@...r.kernel.org>,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] net: called rtnl_unlock() before runpm resumes devices
On Tue, Apr 20, 2021 at 9:54 AM AceLan Kao <acelan.kao@...onical.com> wrote:
>
> From: "Chia-Lin Kao (AceLan)" <acelan.kao@...onical.com>
>
> The rtnl_lock() has been called in rtnetlink_rcv_msg(), and then in
> __dev_open() it calls pm_runtime_resume() to resume devices, and in
> some devices' resume function(igb_resum,igc_resume) they calls rtnl_lock()
> again. That leads to a recursive lock.
>
> It should leave the devices' resume function to decide if they need to
> call rtnl_lock()/rtnl_unlock(), so call rtnl_unlock() before calling
> pm_runtime_resume() and then call rtnl_lock() after it in __dev_open().
>
>
Hi Acelan
When was the bugg added ?
Please add a Fixes: tag
By doing so, you give more chances for reviewers to understand why the
fix is not risky,
and help stable teams work.
Thanks.
> Signed-off-by: Chia-Lin Kao (AceLan) <acelan.kao@...onical.com>
> ---
> net/core/dev.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/net/core/dev.c b/net/core/dev.c
> index 1f79b9aa9a3f..427cbc80d1e5 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
> @@ -1537,8 +1537,11 @@ static int __dev_open(struct net_device *dev, struct netlink_ext_ack *extack)
>
> if (!netif_device_present(dev)) {
> /* may be detached because parent is runtime-suspended */
> - if (dev->dev.parent)
> + if (dev->dev.parent) {
> + rtnl_unlock();
> pm_runtime_resume(dev->dev.parent);
> + rtnl_lock();
> + }
> if (!netif_device_present(dev))
> return -ENODEV;
> }
> --
> 2.25.1
>
Powered by blists - more mailing lists