All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch net] net: devlink: skip info_get op call if it is not defined in dumpit
@ 2019-03-23 23:21 Jiri Pirko
  2019-03-24  3:06 ` Jakub Kicinski
  2019-03-26 18:26 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Jiri Pirko @ 2019-03-23 23:21 UTC (permalink / raw)
  To: netdev; +Cc: davem, mlxsw, idosch, jakub.kicinski

From: Jiri Pirko <jiri@mellanox.com>

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")
Reported-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
---
 net/core/devlink.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/net/core/devlink.c b/net/core/devlink.c
index 78e22cea4cc7..da0a29f30885 100644
--- a/net/core/devlink.c
+++ b/net/core/devlink.c
@@ -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,
-- 
2.17.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [patch net] net: devlink: skip info_get op call if it is not defined in dumpit
  2019-03-23 23:21 [patch net] net: devlink: skip info_get op call if it is not defined in dumpit Jiri Pirko
@ 2019-03-24  3:06 ` Jakub Kicinski
  2019-03-26 18:26 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Jakub Kicinski @ 2019-03-24  3:06 UTC (permalink / raw)
  To: Jiri Pirko; +Cc: netdev, davem, mlxsw, idosch

On Sun, 24 Mar 2019 00:21:03 +0100, Jiri Pirko wrote:
> From: Jiri Pirko <jiri@mellanox.com>
> 
> 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")
> Reported-by: Ido Schimmel <idosch@mellanox.com>
> Signed-off-by: Jiri Pirko <jiri@mellanox.com>

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

Acked-by: Jakub Kicinski <jakub.kicinski@netronome.com>

Thanks/sorry!

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [patch net] net: devlink: skip info_get op call if it is not defined in dumpit
  2019-03-23 23:21 [patch net] net: devlink: skip info_get op call if it is not defined in dumpit Jiri Pirko
  2019-03-24  3:06 ` Jakub Kicinski
@ 2019-03-26 18:26 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2019-03-26 18:26 UTC (permalink / raw)
  To: jiri; +Cc: netdev, mlxsw, idosch, jakub.kicinski

From: Jiri Pirko <jiri@resnulli.us>
Date: Sun, 24 Mar 2019 00:21:03 +0100

> From: Jiri Pirko <jiri@mellanox.com>
> 
> 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")
> Reported-by: Ido Schimmel <idosch@mellanox.com>
> Signed-off-by: Jiri Pirko <jiri@mellanox.com>

Applied.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-03-26 18:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-23 23:21 [patch net] net: devlink: skip info_get op call if it is not defined in dumpit Jiri Pirko
2019-03-24  3:06 ` Jakub Kicinski
2019-03-26 18:26 ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.