net: devlink: skip info_get op call if it is not defined in dumpit
Subsystems (2)
PATCH 1/1 net: devlink: skip info_get op call if it is not defined in dumpit
From: Jiri Pirko <[email protected]>
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.
--- net/core/devlink.c | 5 +++++ 1 file changed, 5 insertions(+)
net/core/devlink.c +5 -0
@@ -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,
Signature · 1 line
2.17.2
Quoted 9 lines · Jiri Pirko
From: Jiri Pirko <[email protected]>
In dumpit, unlike doit, the check for
info_getop being defined is missing. Add it and avoid null pointer dereference in case driver does not define this op.Fixes f9cf22882c60 ("devlink: add device information API")Reported-by Ido Schimmel <[email protected]>Signed-off-by Jiri Pirko <[email protected]>
Ugh, looks like the check got lost in v2 somehow.
Thanks/sorry!
From: Jiri Pirko <[email protected]>
Date: Sun, 24 Mar 2019 00:21:03 +0100
Quoted 9 lines
From: Jiri Pirko <[email protected]>
In dumpit, unlike doit, the check for
info_getop being defined is missing. Add it and avoid null pointer dereference in case driver does not define this op.Fixes f9cf22882c60 ("devlink: add device information API")Reported-by Ido Schimmel <[email protected]>Signed-off-by Jiri Pirko <[email protected]>
Applied.