* [net-next] tipc: do sanity check payload of a netlink message
@ 2020-12-15 3:31 Hoang Huu Le
2020-12-16 21:10 ` patchwork-bot+netdevbpf
0 siblings, 1 reply; 2+ messages in thread
From: Hoang Huu Le @ 2020-12-15 3:31 UTC (permalink / raw)
To: jmaloy, maloy, ying.xue, netdev; +Cc: Hoang Le
From: Hoang Le <hoang.h.le@dektech.com.au>
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>
---
net/tipc/netlink_compat.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/net/tipc/netlink_compat.c b/net/tipc/netlink_compat.c
index 82f154989418..5a1ce64039f7 100644
--- a/net/tipc/netlink_compat.c
+++ b/net/tipc/netlink_compat.c
@@ -213,12 +213,14 @@ static int __tipc_nl_compat_dumpit(struct tipc_nl_compat_cmd_dump *cmd,
}
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;
+ 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;
--
2.25.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [net-next] tipc: do sanity check payload of a netlink message
2020-12-15 3:31 [net-next] tipc: do sanity check payload of a netlink message Hoang Huu Le
@ 2020-12-16 21:10 ` patchwork-bot+netdevbpf
0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2020-12-16 21:10 UTC (permalink / raw)
To: Hoang Huu Le; +Cc: jmaloy, maloy, ying.xue, netdev
Hello:
This patch was applied to netdev/net.git (refs/heads/master):
On Tue, 15 Dec 2020 10:31:51 +0700 you wrote:
> From: Hoang Le <hoang.h.le@dektech.com.au>
>
> 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>
>
> [...]
Here is the summary with links:
- [net-next] tipc: do sanity check payload of a netlink message
https://git.kernel.org/netdev/net/c/c32c928d29de
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-12-16 21:10 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-15 3:31 [net-next] tipc: do sanity check payload of a netlink message Hoang Huu Le
2020-12-16 21:10 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).