* [PATCH -next] mptcp/pm_netlink.c : add check for nla_put_in6_addr
@ 2020-04-21 16:18 Bo YU
2020-04-21 16:32 ` Paolo Abeni
0 siblings, 1 reply; 2+ messages in thread
From: Bo YU @ 2020-04-21 16:18 UTC (permalink / raw)
To: matthieu.baerts, davem, kuba, pabeni, mathew.j.martineau
Cc: netdev, mptcp, tsu.yubo
Normal there should be checked for nla_put_in6_addr like other
usage in net.
Detected by CoverityScan, CID# 1461639
Fixes: 01cacb00b35c("mptcp: add netlink-based PM")
Signed-off-by: Bo YU <tsu.yubo@gmail.com>
---
BWT, I am not sure nla_put_in_addr whether or not to do such that
---
net/mptcp/pm_netlink.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c
index 86d61ab34c7c..f340b00672e1 100644
--- a/net/mptcp/pm_netlink.c
+++ b/net/mptcp/pm_netlink.c
@@ -603,8 +603,9 @@ static int mptcp_nl_fill_addr(struct sk_buff *skb,
nla_put_in_addr(skb, MPTCP_PM_ADDR_ATTR_ADDR4,
addr->addr.s_addr);
#if IS_ENABLED(CONFIG_MPTCP_IPV6)
- else if (addr->family == AF_INET6)
- nla_put_in6_addr(skb, MPTCP_PM_ADDR_ATTR_ADDR6, &addr->addr6);
+ else if (addr->family == AF_INET6 &&
+ nla_put_in6_addr(skb, MPTCP_PM_ADDR_ATTR_ADDR6, &addr->addr6))
+ goto nla_put_failure;
#endif
nla_nest_end(skb, attr);
return 0;
--
2.11.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH -next] mptcp/pm_netlink.c : add check for nla_put_in6_addr
2020-04-21 16:18 [PATCH -next] mptcp/pm_netlink.c : add check for nla_put_in6_addr Bo YU
@ 2020-04-21 16:32 ` Paolo Abeni
0 siblings, 0 replies; 2+ messages in thread
From: Paolo Abeni @ 2020-04-21 16:32 UTC (permalink / raw)
To: Bo YU, matthieu.baerts, davem, kuba, mathew.j.martineau; +Cc: netdev, mptcp
On Wed, 2020-04-22 at 00:18 +0800, Bo YU wrote:
> Normal there should be checked for nla_put_in6_addr like other
> usage in net.
>
> Detected by CoverityScan, CID# 1461639
>
> Fixes: 01cacb00b35c("mptcp: add netlink-based PM")
> Signed-off-by: Bo YU <tsu.yubo@gmail.com>
> ---
> BWT, I am not sure nla_put_in_addr whether or not to do such that
> ---
> net/mptcp/pm_netlink.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c
> index 86d61ab34c7c..f340b00672e1 100644
> --- a/net/mptcp/pm_netlink.c
> +++ b/net/mptcp/pm_netlink.c
> @@ -603,8 +603,9 @@ static int mptcp_nl_fill_addr(struct sk_buff *skb,
> nla_put_in_addr(skb, MPTCP_PM_ADDR_ATTR_ADDR4,
> addr->addr.s_addr);
> #if IS_ENABLED(CONFIG_MPTCP_IPV6)
> - else if (addr->family == AF_INET6)
> - nla_put_in6_addr(skb, MPTCP_PM_ADDR_ATTR_ADDR6, &addr->addr6);
> + else if (addr->family == AF_INET6 &&
> + nla_put_in6_addr(skb, MPTCP_PM_ADDR_ATTR_ADDR6, &addr->addr6))
> + goto nla_put_failure;
> #endif
> nla_nest_end(skb, attr);
> return 0;
This change LGTM, but I think we also need a similar check for
nla_put_in_addr(), thanks!
Paolo
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-04-21 16:32 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-04-21 16:18 [PATCH -next] mptcp/pm_netlink.c : add check for nla_put_in6_addr Bo YU
2020-04-21 16:32 ` Paolo Abeni
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).