Commit 34ac17ec authored by Eric Dumazet's avatar Eric Dumazet Committed by David S. Miller

ethtool: use ethnl_parse_header_dev_put()

It seems I missed that most ethnl_parse_header_dev_get() callers
declare an on-stack struct ethnl_req_info, and that they simply call
dev_put(req_info.dev) when about to return.

Add ethnl_parse_header_dev_put() helper to properly untrack
reference taken by ethnl_parse_header_dev_get().

Fixes: e4b89540 ("netlink: add net device refcount tracker to struct ethnl_req_info")
Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 6cf7a1ac
......@@ -96,7 +96,7 @@ int ethnl_act_cable_test(struct sk_buff *skb, struct genl_info *info)
out_rtnl:
rtnl_unlock();
out_dev_put:
dev_put(dev);
ethnl_parse_header_dev_put(&req_info);
return ret;
}
......@@ -353,7 +353,7 @@ int ethnl_act_cable_test_tdr(struct sk_buff *skb, struct genl_info *info)
out_rtnl:
rtnl_unlock();
out_dev_put:
dev_put(dev);
ethnl_parse_header_dev_put(&req_info);
return ret;
}
......
......@@ -219,6 +219,6 @@ int ethnl_set_channels(struct sk_buff *skb, struct genl_info *info)
out_rtnl:
rtnl_unlock();
out_dev:
dev_put(dev);
ethnl_parse_header_dev_put(&req_info);
return ret;
}
......@@ -336,6 +336,6 @@ int ethnl_set_coalesce(struct sk_buff *skb, struct genl_info *info)
out_rtnl:
rtnl_unlock();
out_dev:
dev_put(dev);
ethnl_parse_header_dev_put(&req_info);
return ret;
}
......@@ -123,6 +123,6 @@ int ethnl_set_debug(struct sk_buff *skb, struct genl_info *info)
out_rtnl:
rtnl_unlock();
out_dev:
dev_put(dev);
ethnl_parse_header_dev_put(&req_info);
return ret;
}
......@@ -185,6 +185,6 @@ int ethnl_set_eee(struct sk_buff *skb, struct genl_info *info)
out_rtnl:
rtnl_unlock();
out_dev:
dev_put(dev);
ethnl_parse_header_dev_put(&req_info);
return ret;
}
......@@ -283,6 +283,6 @@ int ethnl_set_features(struct sk_buff *skb, struct genl_info *info)
out_rtnl:
rtnl_unlock();
dev_put(dev);
ethnl_parse_header_dev_put(&req_info);
return ret;
}
......@@ -305,6 +305,6 @@ int ethnl_set_fec(struct sk_buff *skb, struct genl_info *info)
out_rtnl:
rtnl_unlock();
out_dev:
dev_put(dev);
ethnl_parse_header_dev_put(&req_info);
return ret;
}
......@@ -149,6 +149,6 @@ int ethnl_set_linkinfo(struct sk_buff *skb, struct genl_info *info)
out_rtnl:
rtnl_unlock();
out_dev:
dev_put(dev);
ethnl_parse_header_dev_put(&req_info);
return ret;
}
......@@ -358,6 +358,6 @@ int ethnl_set_linkmodes(struct sk_buff *skb, struct genl_info *info)
out_rtnl:
rtnl_unlock();
out_dev:
dev_put(dev);
ethnl_parse_header_dev_put(&req_info);
return ret;
}
......@@ -175,6 +175,6 @@ int ethnl_set_module(struct sk_buff *skb, struct genl_info *info)
ethnl_ops_complete(dev);
out_rtnl:
rtnl_unlock();
dev_put(dev);
ethnl_parse_header_dev_put(&req_info);
return ret;
}
......@@ -235,6 +235,11 @@ struct ethnl_req_info {
u32 flags;
};
static inline void ethnl_parse_header_dev_put(struct ethnl_req_info *req_info)
{
dev_put_track(req_info->dev, &req_info->dev_tracker);
}
/**
* struct ethnl_reply_data - base type of reply data for GET requests
* @dev: device for current reply message; in single shot requests it is
......
......@@ -181,6 +181,6 @@ int ethnl_set_pause(struct sk_buff *skb, struct genl_info *info)
out_rtnl:
rtnl_unlock();
out_dev:
dev_put(dev);
ethnl_parse_header_dev_put(&req_info);
return ret;
}
......@@ -196,6 +196,6 @@ int ethnl_set_privflags(struct sk_buff *skb, struct genl_info *info)
out_rtnl:
rtnl_unlock();
out_dev:
dev_put(dev);
ethnl_parse_header_dev_put(&req_info);
return ret;
}
......@@ -196,6 +196,6 @@ int ethnl_set_rings(struct sk_buff *skb, struct genl_info *info)
out_rtnl:
rtnl_unlock();
out_dev:
dev_put(dev);
ethnl_parse_header_dev_put(&req_info);
return ret;
}
......@@ -195,7 +195,7 @@ int ethnl_tunnel_info_doit(struct sk_buff *skb, struct genl_info *info)
if (ret)
goto err_free_msg;
rtnl_unlock();
dev_put(req_info.dev);
ethnl_parse_header_dev_put(&req_info);
genlmsg_end(rskb, reply_payload);
return genlmsg_reply(rskb, info);
......@@ -204,7 +204,7 @@ int ethnl_tunnel_info_doit(struct sk_buff *skb, struct genl_info *info)
nlmsg_free(rskb);
err_unlock_rtnl:
rtnl_unlock();
dev_put(req_info.dev);
ethnl_parse_header_dev_put(&req_info);
return ret;
}
......@@ -230,7 +230,7 @@ int ethnl_tunnel_info_start(struct netlink_callback *cb)
sock_net(cb->skb->sk), cb->extack,
false);
if (ctx->req_info.dev) {
dev_put(ctx->req_info.dev);
ethnl_parse_header_dev_put(&ctx->req_info);
ctx->req_info.dev = NULL;
}
......
......@@ -165,6 +165,6 @@ int ethnl_set_wol(struct sk_buff *skb, struct genl_info *info)
out_rtnl:
rtnl_unlock();
out_dev:
dev_put(dev);
ethnl_parse_header_dev_put(&req_info);
return ret;
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment