Re: [PATCH net-next v2] net: ethtool: Fix suspicious rcu_dereference usage
From: Eric Dumazet
Date: Fri Dec 20 2024 - 11:34:04 EST
On Fri, Dec 20, 2024 at 9:37 AM Kory Maincent <kory.maincent@xxxxxxxxxxx> wrote:
>
> The __ethtool_get_ts_info function can be called with or without the
> rtnl lock held. When the rtnl lock is not held, using rtnl_dereference()
> triggers a warning due to the lack of lock context.
>
> Add an rcu_read_lock() to ensure the lock is acquired and to maintain
> synchronization.
>
> Reported-by: syzbot+a344326c05c98ba19682@xxxxxxxxxxxxxxxxxxxxxxxxx
> Closes: https://lore.kernel.org/netdev/676147f8.050a0220.37aaf.0154.GAE@xxxxxxxxxx/
> Fixes: b9e3f7dc9ed9 ("net: ethtool: tsinfo: Enhance tsinfo to support several hwtstamp by net topology")
> Signed-off-by: Kory Maincent <kory.maincent@xxxxxxxxxxx>
> ---
Reviewed-by: Eric Dumazet <edumazet@xxxxxxxxxx>