Skip to content

Commit 6ea6776

Browse files
jpirkoJakub Kicinski
authored andcommitted
net: tipc: prepare attrs in __tipc_nl_compat_dumpit()
__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: 057af70 ("net: tipc: have genetlink code to parse the attrs during dumpit") Signed-off-by: Jiri Pirko <jiri@mellanox.com> Acked-by: Jon Maloy <jon.maloy@ericsson.com> Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
1 parent ab5b526 commit 6ea6776

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

net/tipc/netlink_compat.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@ static int __tipc_nl_compat_dumpit(struct tipc_nl_compat_cmd_dump *cmd,
181181
struct tipc_nl_compat_msg *msg,
182182
struct sk_buff *arg)
183183
{
184+
struct genl_dumpit_info info;
184185
int len = 0;
185186
int err;
186187
struct sk_buff *buf;
@@ -191,6 +192,7 @@ static int __tipc_nl_compat_dumpit(struct tipc_nl_compat_cmd_dump *cmd,
191192
memset(&cb, 0, sizeof(cb));
192193
cb.nlh = (struct nlmsghdr *)arg->data;
193194
cb.skb = arg;
195+
cb.data = &info;
194196

195197
buf = nlmsg_new(NLMSG_GOODSIZE, GFP_KERNEL);
196198
if (!buf)
@@ -209,6 +211,13 @@ static int __tipc_nl_compat_dumpit(struct tipc_nl_compat_cmd_dump *cmd,
209211
goto err_out;
210212
}
211213

214+
info.attrs = attrbuf;
215+
err = nlmsg_parse_deprecated(cb.nlh, GENL_HDRLEN, attrbuf,
216+
tipc_genl_family.maxattr,
217+
tipc_genl_family.policy, NULL);
218+
if (err)
219+
goto err_out;
220+
212221
do {
213222
int rem;
214223

0 commit comments

Comments
 (0)