Commit 3bc14ea0 authored by Jakub Kicinski's avatar Jakub Kicinski Committed by David S. Miller

ethtool: always write dev in ethnl_parse_header_dev_get

Commit 0976b888 ("ethtool: fix null-ptr-deref on ref tracker")
made the write to req_info.dev conditional, but as Eric points out
in a different follow up the structure is often allocated on the
stack and not kzalloc()'d so seems safer to always write the dev,
in case it's garbage on input.
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
Reviewed-by: default avatarEric Dumazet <edumazet@google.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent f1d9268e
...@@ -141,10 +141,9 @@ int ethnl_parse_header_dev_get(struct ethnl_req_info *req_info, ...@@ -141,10 +141,9 @@ int ethnl_parse_header_dev_get(struct ethnl_req_info *req_info,
return -EINVAL; return -EINVAL;
} }
if (dev) { req_info->dev = dev;
req_info->dev = dev; if (dev)
netdev_tracker_alloc(dev, &req_info->dev_tracker, GFP_KERNEL); netdev_tracker_alloc(dev, &req_info->dev_tracker, GFP_KERNEL);
}
req_info->flags = flags; req_info->flags = flags;
return 0; return 0;
} }
......
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