Skip to content

Commit

Permalink
net: devlink: skip info_get op call if it is not defined in dumpit
Browse files Browse the repository at this point in the history
In dumpit, unlike doit, the check for info_get op being defined
is missing. Add it and avoid null pointer dereference in case driver
does not define this op.

Fixes: f9cf228 ("devlink: add device information API")
Reported-by: Ido Schimmel <[email protected]>
Signed-off-by: Jiri Pirko <[email protected]>
Acked-by: Jakub Kicinski <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
jpirko authored and davem330 committed Mar 26, 2019
1 parent 450895d commit c493b09
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions net/core/devlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -3897,6 +3897,11 @@ static int devlink_nl_cmd_info_get_dumpit(struct sk_buff *msg,
continue;
}

if (!devlink->ops->info_get) {
idx++;
continue;
}

mutex_lock(&devlink->lock);
err = devlink_nl_info_fill(msg, devlink, DEVLINK_CMD_INFO_GET,
NETLINK_CB(cb->skb).portid,
Expand Down

0 comments on commit c493b09

Please sign in to comment.