forked from mirrors/linux
		
	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: 057af70713 ("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>
			
			
This commit is contained in:
		
							parent
							
								
									ab5b526da0
								
							
						
					
					
						commit
						6ea67769ff
					
				
					 1 changed files with 9 additions and 0 deletions
				
			
		| 
						 | 
					@ -181,6 +181,7 @@ static int __tipc_nl_compat_dumpit(struct tipc_nl_compat_cmd_dump *cmd,
 | 
				
			||||||
				   struct tipc_nl_compat_msg *msg,
 | 
									   struct tipc_nl_compat_msg *msg,
 | 
				
			||||||
				   struct sk_buff *arg)
 | 
									   struct sk_buff *arg)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
						struct genl_dumpit_info info;
 | 
				
			||||||
	int len = 0;
 | 
						int len = 0;
 | 
				
			||||||
	int err;
 | 
						int err;
 | 
				
			||||||
	struct sk_buff *buf;
 | 
						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));
 | 
						memset(&cb, 0, sizeof(cb));
 | 
				
			||||||
	cb.nlh = (struct nlmsghdr *)arg->data;
 | 
						cb.nlh = (struct nlmsghdr *)arg->data;
 | 
				
			||||||
	cb.skb = arg;
 | 
						cb.skb = arg;
 | 
				
			||||||
 | 
						cb.data = &info;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	buf = nlmsg_new(NLMSG_GOODSIZE, GFP_KERNEL);
 | 
						buf = nlmsg_new(NLMSG_GOODSIZE, GFP_KERNEL);
 | 
				
			||||||
	if (!buf)
 | 
						if (!buf)
 | 
				
			||||||
| 
						 | 
					@ -209,6 +211,13 @@ static int __tipc_nl_compat_dumpit(struct tipc_nl_compat_cmd_dump *cmd,
 | 
				
			||||||
		goto err_out;
 | 
							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 {
 | 
						do {
 | 
				
			||||||
		int rem;
 | 
							int rem;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue