summaryrefslogtreecommitdiff
path: root/net/devlink/dev.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/devlink/dev.c')
-rw-r--r--net/devlink/dev.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/net/devlink/dev.c b/net/devlink/dev.c
index 57b2b8f03543..55959b0ff5ab 100644
--- a/net/devlink/dev.c
+++ b/net/devlink/dev.c
@@ -222,7 +222,7 @@ static void devlink_notify(struct devlink *devlink, enum devlink_command cmd)
int devlink_nl_get_doit(struct sk_buff *skb, struct genl_info *info)
{
- struct devlink *devlink = info->user_ptr[0];
+ struct devlink *devlink = devlink_nl_ctx(info)->devlink;
struct sk_buff *msg;
int err;
@@ -519,7 +519,7 @@ free_msg:
int devlink_nl_reload_doit(struct sk_buff *skb, struct genl_info *info)
{
- struct devlink *devlink = info->user_ptr[0];
+ struct devlink *devlink = devlink_nl_ctx(info)->devlink;
enum devlink_reload_action action;
enum devlink_reload_limit limit;
struct net *dest_net = NULL;
@@ -578,6 +578,7 @@ int devlink_nl_reload_doit(struct sk_buff *skb, struct genl_info *info)
action != DEVLINK_RELOAD_ACTION_DRIVER_REINIT) {
NL_SET_ERR_MSG_MOD(info->extack,
"Changing namespace is only supported for reinit action");
+ put_net(dest_net);
return -EOPNOTSUPP;
}
}
@@ -683,7 +684,7 @@ nla_put_failure:
int devlink_nl_eswitch_get_doit(struct sk_buff *skb, struct genl_info *info)
{
- struct devlink *devlink = info->user_ptr[0];
+ struct devlink *devlink = devlink_nl_ctx(info)->devlink;
struct sk_buff *msg;
int err;
@@ -704,7 +705,7 @@ int devlink_nl_eswitch_get_doit(struct sk_buff *skb, struct genl_info *info)
int devlink_nl_eswitch_set_doit(struct sk_buff *skb, struct genl_info *info)
{
- struct devlink *devlink = info->user_ptr[0];
+ struct devlink *devlink = devlink_nl_ctx(info)->devlink;
const struct devlink_ops *ops = devlink->ops;
enum devlink_eswitch_encap_mode encap_mode;
u8 inline_mode;
@@ -906,7 +907,7 @@ err_cancel_msg:
int devlink_nl_info_get_doit(struct sk_buff *skb, struct genl_info *info)
{
- struct devlink *devlink = info->user_ptr[0];
+ struct devlink *devlink = devlink_nl_ctx(info)->devlink;
struct sk_buff *msg;
int err;
@@ -1134,7 +1135,7 @@ int devlink_nl_flash_update_doit(struct sk_buff *skb, struct genl_info *info)
{
struct nlattr *nla_overwrite_mask, *nla_file_name;
struct devlink_flash_update_params params = {};
- struct devlink *devlink = info->user_ptr[0];
+ struct devlink *devlink = devlink_nl_ctx(info)->devlink;
const char *file_name;
u32 supported_params;
int ret;
@@ -1302,7 +1303,7 @@ err_cancel_msg:
int devlink_nl_selftests_get_doit(struct sk_buff *skb, struct genl_info *info)
{
- struct devlink *devlink = info->user_ptr[0];
+ struct devlink *devlink = devlink_nl_ctx(info)->devlink;
struct sk_buff *msg;
int err;
@@ -1372,7 +1373,7 @@ static const struct nla_policy devlink_selftest_nl_policy[DEVLINK_ATTR_SELFTEST_
int devlink_nl_selftests_run_doit(struct sk_buff *skb, struct genl_info *info)
{
struct nlattr *tb[DEVLINK_ATTR_SELFTEST_ID_MAX + 1];
- struct devlink *devlink = info->user_ptr[0];
+ struct devlink *devlink = devlink_nl_ctx(info)->devlink;
struct nlattr *attrs, *selftests;
struct sk_buff *msg;
void *hdr;