All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch net-next] net: tipc: prepare attrs in __tipc_nl_compat_dumpit()
@ 2019-10-08 11:01 Jiri Pirko
  2019-10-08 13:52 ` Jon Maloy
  2019-10-09  1:07 ` Jakub Kicinski
  0 siblings, 2 replies; 3+ messages in thread
From: Jiri Pirko @ 2019-10-08 11:01 UTC (permalink / raw)
  To: netdev; +Cc: davem, jon.maloy, ying.xue, johannes.berg, mkubecek, mlxsw

From: Jiri Pirko <jiri@mellanox.com>

__tipc_nl_compat_dumpit() calls tipc_nl_publ_dump() which expects
the attrs to be available by genl_dumpit_info(cb)->attrs. Add info
struct and attr parsing in compat dumpit function.

Reported-by: syzbot+8d37c50ffb0f52941a5e@syzkaller.appspotmail.com
Fixes: 057af7071344 ("net: tipc: have genetlink code to parse the attrs during dumpit")

Signed-off-by: Jiri Pirko <jiri@mellanox.com>
---
 net/tipc/netlink_compat.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/net/tipc/netlink_compat.c b/net/tipc/netlink_compat.c
index 4950b754dacd..17a529739f8d 100644
--- a/net/tipc/netlink_compat.c
+++ b/net/tipc/netlink_compat.c
@@ -181,6 +181,7 @@ static int __tipc_nl_compat_dumpit(struct tipc_nl_compat_cmd_dump *cmd,
 				   struct tipc_nl_compat_msg *msg,
 				   struct sk_buff *arg)
 {
+	struct genl_dumpit_info info;
 	int len = 0;
 	int err;
 	struct sk_buff *buf;
@@ -191,6 +192,7 @@ static int __tipc_nl_compat_dumpit(struct tipc_nl_compat_cmd_dump *cmd,
 	memset(&cb, 0, sizeof(cb));
 	cb.nlh = (struct nlmsghdr *)arg->data;
 	cb.skb = arg;
+	cb.data = &info;
 
 	buf = nlmsg_new(NLMSG_GOODSIZE, GFP_KERNEL);
 	if (!buf)
@@ -209,6 +211,13 @@ static int __tipc_nl_compat_dumpit(struct tipc_nl_compat_cmd_dump *cmd,
 		goto err_out;
 	}
 
+	info.attrs = attrbuf;
+	err = nlmsg_parse_deprecated(cb.nlh, GENL_HDRLEN, attrbuf,
+				     tipc_genl_family.maxattr,
+				     tipc_genl_family.policy, NULL);
+	if (err)
+		goto err_out;
+
 	do {
 		int rem;
 
-- 
2.21.0


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

end of thread, other threads:[~2019-10-09  1:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-08 11:01 [patch net-next] net: tipc: prepare attrs in __tipc_nl_compat_dumpit() Jiri Pirko
2019-10-08 13:52 ` Jon Maloy
2019-10-09  1:07 ` Jakub Kicinski

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.