* [PATCH net] ethtool: netlink: Add missing ethnl_ops_begin/complete
@ 2024-01-08 15:17 Ludvig Pärsson
2024-01-11 11:30 ` Paolo Abeni
0 siblings, 1 reply; 2+ messages in thread
From: Ludvig Pärsson @ 2024-01-08 15:17 UTC (permalink / raw)
To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni
Cc: netdev, linux-kernel, kernel, Ludvig Pärsson
Accessing an ethernet device that is powered off or clock gated might
cause the CPU to hang. Add ethnl_ops_begin/complete in
ethnl_set_features() to protect against this.
Signed-off-by: Ludvig Pärsson <ludvig.parsson@axis.com>
---
net/ethtool/features.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/net/ethtool/features.c b/net/ethtool/features.c
index a79af8c25a07..b6cb101d7f19 100644
--- a/net/ethtool/features.c
+++ b/net/ethtool/features.c
@@ -234,17 +234,20 @@ int ethnl_set_features(struct sk_buff *skb, struct genl_info *info)
dev = req_info.dev;
rtnl_lock();
+ ret = ethnl_ops_begin(dev);
+ if (ret < 0)
+ goto out_rtnl;
ethnl_features_to_bitmap(old_active, dev->features);
ethnl_features_to_bitmap(old_wanted, dev->wanted_features);
ret = ethnl_parse_bitset(req_wanted, req_mask, NETDEV_FEATURE_COUNT,
tb[ETHTOOL_A_FEATURES_WANTED],
netdev_features_strings, info->extack);
if (ret < 0)
- goto out_rtnl;
+ goto out_ops;
if (ethnl_bitmap_to_features(req_mask) & ~NETIF_F_ETHTOOL_BITS) {
GENL_SET_ERR_MSG(info, "attempt to change non-ethtool features");
ret = -EINVAL;
- goto out_rtnl;
+ goto out_ops;
}
/* set req_wanted bits not in req_mask from old_wanted */
@@ -281,6 +284,8 @@ int ethnl_set_features(struct sk_buff *skb, struct genl_info *info)
if (mod)
netdev_features_change(dev);
+out_ops:
+ ethnl_ops_complete(dev);
out_rtnl:
rtnl_unlock();
ethnl_parse_header_dev_put(&req_info);
---
base-commit: 0dd3ee31125508cd67f7e7172247f05b7fd1753a
change-id: 20240108-etht2-2b2454e837e7
Best regards,
--
Ludvig Pärsson <ludvig.parsson@axis.com>
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH net] ethtool: netlink: Add missing ethnl_ops_begin/complete
2024-01-08 15:17 [PATCH net] ethtool: netlink: Add missing ethnl_ops_begin/complete Ludvig Pärsson
@ 2024-01-11 11:30 ` Paolo Abeni
0 siblings, 0 replies; 2+ messages in thread
From: Paolo Abeni @ 2024-01-11 11:30 UTC (permalink / raw)
To: Ludvig Pärsson, David S. Miller, Eric Dumazet, Jakub Kicinski
Cc: netdev, linux-kernel, kernel
On Mon, 2024-01-08 at 16:17 +0100, Ludvig Pärsson wrote:
> Accessing an ethernet device that is powered off or clock gated might
> cause the CPU to hang. Add ethnl_ops_begin/complete in
> ethnl_set_features() to protect against this.
>
We need a suitable Fixes tag here
> Signed-off-by: Ludvig Pärsson <ludvig.parsson@axis.com>
> ---
> net/ethtool/features.c | 9 +++++++--
> 1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/net/ethtool/features.c b/net/ethtool/features.c
> index a79af8c25a07..b6cb101d7f19 100644
> --- a/net/ethtool/features.c
> +++ b/net/ethtool/features.c
> @@ -234,17 +234,20 @@ int ethnl_set_features(struct sk_buff *skb, struct genl_info *info)
> dev = req_info.dev;
>
> rtnl_lock();
> + ret = ethnl_ops_begin(dev);
> + if (ret < 0)
> + goto out_rtnl;
You should likely follow-up on net-next only converting
ethnl_set_features to ethnl_default_set_doit.
Cheers,
Paolo
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-01-11 11:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-08 15:17 [PATCH net] ethtool: netlink: Add missing ethnl_ops_begin/complete Ludvig Pärsson
2024-01-11 11:30 ` Paolo Abeni
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.