Skip to contentSkip to conversation

net: tipc: prepare attrs in __tipc_nl_compat_dumpit()

PATCH In review Jiri Pirko 3 participants 3 messages Oct 8, 2019 – Oct 9, 2019

Subsystems (3)
lore
Share & tools
lore

Jiri Pirko

author
#0 lore raw

PATCH 1/1 net: tipc: prepare attrs in __tipc_nl_compat_dumpit()

From: Jiri Pirko <[email protected]>

__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 [email protected]
Fixes 057af7071344 ("net: tipc: have genetlink code to parse the attrs during dumpit")
---
 net/tipc/netlink_compat.c | 9 +++++++++
 1 file changed, 9 insertions(+)
net/tipc/netlink_compat.c +9 -0
index 4950b754dacd..17a529739f8d 100644
@@ -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;
 
Signature · 1 line
2.21.0
#1 lore raw

Acked. Thanks Jiri.

///jon

Quoted 64 lines

-----Original Message-----
From: Jiri Pirko <[email protected]>
Sent: 8-Oct-19 07:02
To: [email protected]
Cc: [email protected]; Jon Maloy <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]
Subject: [patch net-next] net: tipc: prepare attrs in __tipc_nl_compat_dumpit()

From: Jiri Pirko <[email protected]>

__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 [email protected]
Fixes 057af7071344 ("net: tipc: have genetlink code to parse the attrs during

dumpit")

---
 net/tipc/netlink_compat.c | 9 +++++++++
 1 file changed, 9 insertions(+)
net/tipc/netlink_compat.c index renamed from net/tipc/netlink_compat.c +0 -0

4950b754dacd..17a529739f8d 100644

net/tipc/netlink_compat.c +1 -0
@@ -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;
net/tipc/netlink_compat.c +1 -0
 	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);
net/tipc/netlink_compat.c +7 -1
 	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

#2 lore raw
In reply to Jiri Pirko
Quoted 10 lines · Jiri Pirko

From: Jiri Pirko <[email protected]>

__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 [email protected]
Fixes 057af7071344 ("net: tipc: have genetlink code to parse the attrs during dumpit")

Dropped the empty line between Fixes and the signoff and applied.

Jon, please post a fully formed Acked-by: ... tag, if you could, otherwise automation doesn't pick it up.