Skip to content

Commit c493b09

Browse files
jpirkodavem330
authored andcommitted
net: devlink: skip info_get op call if it is not defined in dumpit
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 <idosch@mellanox.com> Signed-off-by: Jiri Pirko <jiri@mellanox.com> Acked-by: Jakub Kicinski <jakub.kicinski@netronome.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 450895d commit c493b09

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

net/core/devlink.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3897,6 +3897,11 @@ static int devlink_nl_cmd_info_get_dumpit(struct sk_buff *msg,
38973897
continue;
38983898
}
38993899

3900+
if (!devlink->ops->info_get) {
3901+
idx++;
3902+
continue;
3903+
}
3904+
39003905
mutex_lock(&devlink->lock);
39013906
err = devlink_nl_info_fill(msg, devlink, DEVLINK_CMD_INFO_GET,
39023907
NETLINK_CB(cb->skb).portid,

0 commit comments

Comments
 (0)