Skip to contentSkip to conversation

net: devlink: skip info_get op call if it is not defined in dumpit

PATCH Applied Jiri Pirko 3 participants 3 messages Mar 23, 2019 – Mar 26, 2019

Subsystems (2)
lore
Share & tools
lore

Jiri Pirko

author
#0 lore raw

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.

Fixes f9cf22882c60 ("devlink: add device information API")
---
 net/core/devlink.c | 5 +++++
 1 file changed, 5 insertions(+)
net/core/devlink.c +5 -0
index 78e22cea4cc7..da0a29f30885 100644
@@ -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
Acked-by on v1 1/1
#1 lore raw
Quoted 9 lines · Jiri Pirko

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.

Fixes f9cf22882c60 ("devlink: add device information API")

Ugh, looks like the check got lost in v2 somehow.

Thanks/sorry!

maintainer Applied
#2 lore raw
In reply to Jiri Pirko

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_get op 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")

Applied.