]> Git Repo - linux.git/commitdiff
ethtool: fix null-ptr-deref on ref tracker
authorJakub Kicinski <[email protected]>
Tue, 14 Dec 2021 01:39:02 +0000 (17:39 -0800)
committerDavid S. Miller <[email protected]>
Tue, 14 Dec 2021 12:35:56 +0000 (12:35 +0000)
dev can be a NULL here, not all requests set require_dev.

Fixes: e4b8954074f6 ("netlink: add net device refcount tracker to struct ethnl_req_info")
Signed-off-by: Jakub Kicinski <[email protected]>
Reviewed-by: Eric Dumazet <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
net/ethtool/netlink.c

index 23f32a995099ab420d25651d85c192210b76442f..767fb3f17267602ef25ab678a8910072c266d898 100644 (file)
@@ -141,8 +141,10 @@ int ethnl_parse_header_dev_get(struct ethnl_req_info *req_info,
                return -EINVAL;
        }
 
-       req_info->dev = dev;
-       netdev_tracker_alloc(dev, &req_info->dev_tracker, GFP_KERNEL);
+       if (dev) {
+               req_info->dev = dev;
+               netdev_tracker_alloc(dev, &req_info->dev_tracker, GFP_KERNEL);
+       }
        req_info->flags = flags;
        return 0;
 }
This page took 0.080735 seconds and 4 git commands to generate.