From: Claudiu Beznea <claudiu.beznea@tuxon.dev>
To: Kory Maincent <kory.maincent@bootlin.com>
Cc: "Paul Barker" <paul.barker.ct@bp.renesas.com>,
"Niklas Söderlund" <niklas.soderlund@ragnatech.se>,
"Andrew Lunn" <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
"Eric Dumazet" <edumazet@google.com>,
"Jakub Kicinski" <kuba@kernel.org>,
"Paolo Abeni" <pabeni@redhat.com>,
"Mikhail Ulyanov" <mikhail.ulyanov@cogentembedded.com>,
"Sergei Shtylyov" <sergei.shtylyov@cogentembedded.com>,
"Thomas Petazzoni" <thomas.petazzoni@bootlin.com>,
"Niklas Söderlund" <niklas.soderlund+renesas@ragnatech.se>,
"Claudiu Beznea" <claudiu.beznea.uj@bp.renesas.com>,
netdev@vger.kernel.org, linux-renesas-soc@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH net 1/2] net: ravb: Fix missing rtnl lock in suspend path
Date: Thu, 23 Jan 2025 16:17:58 +0200 [thread overview]
Message-ID: <cdf4e312-92bc-44f3-a049-bd3ddf3222e1@tuxon.dev> (raw)
In-Reply-To: <20250123150814.6c46ec9a@kmaincent-XPS-13-7390>
On 23.01.2025 16:08, Kory Maincent wrote:
> On Thu, 23 Jan 2025 13:33:30 +0200
> Claudiu Beznea <claudiu.beznea@tuxon.dev> wrote:
>
>> Hi, Kory,
>>
>> On 22.01.2025 18:19, Kory Maincent wrote:
>>> Fix the suspend path by ensuring the rtnl lock is held where required.
>>> Calls to ravb_open, ravb_close and wol operations must be performed under
>>> the rtnl lock to prevent conflicts with ongoing ndo operations.
>
>>
>> I've test it. Looks good.
>>
>> Thank you for your patch. However, I think this could be simplified. The
>> locking scheme looks complicated to me. E.g., this one works too:
>>
>> diff --git a/drivers/net/ethernet/renesas/ravb_main.c
>> b/drivers/net/ethernet/renesas/ravb_main.c
>> index bc395294a32d..cfe4f0f364f3 100644
>> --- a/drivers/net/ethernet/renesas/ravb_main.c
>> +++ b/drivers/net/ethernet/renesas/ravb_main.c
>> @@ -3217,10 +3217,16 @@ static int ravb_suspend(struct device *dev)
>>
>> netif_device_detach(ndev);
>>
>> - if (priv->wol_enabled)
>> - return ravb_wol_setup(ndev);
>> + if (priv->wol_enabled) {
>> + rtnl_lock();
>> + ret = ravb_wol_setup(ndev);
>> + rtnl_unlock();
>> + return ret;
>> + }
>
> What happen if wol_enabled flag changes it state between the rtnl_lock and the
> if condition? We will be in the wrong path.
wol_enabled flag can't change in this suspend phase. The user space tasks
are fronzen when ravb_suspend() is called.
Thank you,
Claudiu
>
> Regards,
next prev parent reply other threads:[~2025-01-23 14:18 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-22 16:19 [PATCH net 0/2] Fix missing rtnl lock in suspend path Kory Maincent
2025-01-22 16:19 ` [PATCH net 1/2] net: ravb: " Kory Maincent
2025-01-22 17:22 ` Niklas Söderlund
2025-01-22 18:33 ` Sergey Shtylyov
2025-01-22 18:53 ` Sergey Shtylyov
2025-01-23 9:30 ` Paul Barker
2025-01-23 11:33 ` Claudiu Beznea
2025-01-23 14:08 ` Kory Maincent
2025-01-23 14:17 ` Claudiu Beznea [this message]
2025-01-23 14:38 ` Kory Maincent
2025-01-22 16:19 ` [PATCH net 2/2] net: sh_eth: " Kory Maincent
2025-01-22 17:12 ` Niklas Söderlund
2025-01-22 18:39 ` Sergey Shtylyov
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=cdf4e312-92bc-44f3-a049-bd3ddf3222e1@tuxon.dev \
--to=claudiu.beznea@tuxon.dev \
--cc=andrew+netdev@lunn.ch \
--cc=claudiu.beznea.uj@bp.renesas.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kory.maincent@bootlin.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=mikhail.ulyanov@cogentembedded.com \
--cc=netdev@vger.kernel.org \
--cc=niklas.soderlund+renesas@ragnatech.se \
--cc=niklas.soderlund@ragnatech.se \
--cc=pabeni@redhat.com \
--cc=paul.barker.ct@bp.renesas.com \
--cc=sergei.shtylyov@cogentembedded.com \
--cc=thomas.petazzoni@bootlin.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