Skip to content

Commit 3bc14ea

Browse files
kuba-moodavem330
authored andcommitted
ethtool: always write dev in ethnl_parse_header_dev_get
Commit 0976b88 ("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: Jakub Kicinski <[email protected]> Reviewed-by: Eric Dumazet <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent f1d9268 commit 3bc14ea

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

net/ethtool/netlink.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,10 +141,9 @@ int ethnl_parse_header_dev_get(struct ethnl_req_info *req_info,
141141
return -EINVAL;
142142
}
143143

144-
if (dev) {
145-
req_info->dev = dev;
144+
req_info->dev = dev;
145+
if (dev)
146146
netdev_tracker_alloc(dev, &req_info->dev_tracker, GFP_KERNEL);
147-
}
148147
req_info->flags = flags;
149148
return 0;
150149
}

0 commit comments

Comments
 (0)