mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-24 01:09:38 -05:00
tipc: do sanity check payload of a netlink message
When we initialize nlmsghdr with no payload inside tipc_nl_compat_dumpit() the parsing function returns -EINVAL. We fix it by making the parsing call conditional. Acked-by: Jon Maloy <jmaloy@redhat.com> Signed-off-by: Hoang Le <hoang.h.le@dektech.com.au> Link: https://lore.kernel.org/r/20201215033151.76139-1-hoang.h.le@dektech.com.au Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
023cae857b
commit
c32c928d29
1 changed files with 7 additions and 5 deletions
|
@ -213,12 +213,14 @@ static int __tipc_nl_compat_dumpit(struct tipc_nl_compat_cmd_dump *cmd,
|
|||
}
|
||||
|
||||
info.attrs = attrbuf;
|
||||
|
||||
if (nlmsg_len(cb.nlh) > 0) {
|
||||
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;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue