diff options
author | Vladimir Oltean <[email protected]> | 2023-01-24 13:08:01 +0200 |
---|---|---|
committer | David S. Miller <[email protected]> | 2023-01-25 09:56:31 +0000 |
commit | c96de136329b38172f21214021fc30d67f05c399 (patch) | |
tree | ea1a151d7aefc6291aa8981bbb2eb442f108b31f /tools/testing/selftests/bpf/prog_tests/autoload.c | |
parent | 99db6fb04317c289528e0d51d65c41938a375621 (diff) |
net: ethtool: fix NULL pointer dereference in stats_prepare_data()
In the following call path:
ethnl_default_dumpit
-> ethnl_default_dump_one
-> ctx->ops->prepare_data
-> stats_prepare_data
struct genl_info *info will be passed as NULL, and stats_prepare_data()
dereferences it while getting the extended ack pointer.
To avoid that, just set the extack to NULL if "info" is NULL, since the
netlink extack handling messages know how to deal with that.
The pattern "info ? info->extack : NULL" is present in quite a few other
"prepare_data" implementations, so it's clear that it's a more general
problem to be dealt with at a higher level, but the code should have at
least adhered to the current conventions to avoid the NULL dereference.
Fixes: 04692c9020b7 ("net: ethtool: netlink: retrieve stats from multiple sources (eMAC, pMAC)")
Reported-by: Eric Dumazet <[email protected]>
Signed-off-by: Vladimir Oltean <[email protected]>
Reviewed-by: Leon Romanovsky <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
Diffstat (limited to 'tools/testing/selftests/bpf/prog_tests/autoload.c')
0 files changed, 0 insertions, 0 deletions