[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20240725.112217.1430301118501739414.syoshida@redhat.com>
Date: Thu, 25 Jul 2024 11:22:17 +0900 (JST)
From: Shigeru Yoshida <syoshida@...hat.com>
To: jamie.bainbridge@...il.com
Cc: netdev@...r.kernel.org, davem@...emloft.net, edumazet@...gle.com,
kuba@...nel.org, pabeni@...hat.com, johannes.berg@...el.com,
jiri@...nulli.us, linux-kernel@...r.kernel.org
Subject: Re: [PATCH net 1/4] net-sysfs: check device is present when
showing carrier
Hi Jamie,
On Wed, 24 Jul 2024 11:46:50 +1000, Jamie Bainbridge wrote:
> A sysfs reader can race with a device reset or removal.
>
> This was fixed for speed_show with commit 4224cfd7fb65 ("net-sysfs: add
> check for netdevice being present to speed_show") so add the same check
> to carrier_show.
>
> Fixes: facd15dfd691 ("net: core: synchronize link-watch when carrier is queried")
>
> Signed-off-by: Jamie Bainbridge <jamie.bainbridge@...il.com>
nit: When resubmitting your fix, there is no need for a blank line
between the Fixes and SOB tags.
Thanks,
Shigeru
> ---
> net/core/net-sysfs.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c
> index 0e2084ce7b7572bff458ed7e02358d9258c74628..7fabe5afa3012ecad6551e12f478b755952933b8 100644
> --- a/net/core/net-sysfs.c
> +++ b/net/core/net-sysfs.c
> @@ -206,7 +206,7 @@ static ssize_t carrier_show(struct device *dev,
> if (!rtnl_trylock())
> return restart_syscall();
>
> - if (netif_running(netdev)) {
> + if (netif_running(netdev) && netif_device_present(netdev)) {
> /* Synchronize carrier state with link watch,
> * see also rtnl_getlink().
> */
> --
> 2.39.2
>
>
Powered by blists - more mailing lists