All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ipv6: Fix error path to cancel the meseage
@ 2020-11-12  8:09 Zhang Qilong
  2020-11-14  2:22 ` Jakub Kicinski
  0 siblings, 1 reply; 3+ messages in thread
From: Zhang Qilong @ 2020-11-12  8:09 UTC (permalink / raw)
  To: davem, kuznet, yoshfuji, kuba; +Cc: netdev

genlmsg_cancel() needs to be called in the error path of
inet6_fill_ifmcaddr and inet6_fill_ifacaddr to cancel
the message.

Fixes: 203651b665f72 ("ipv6: add inet6_fill_args")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Zhang Qilong <zhangqilong3@huawei.com>
---
 net/ipv6/addrconf.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 4211e960130c..eff2cacd5209 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -5023,8 +5023,10 @@ static int inet6_fill_ifmcaddr(struct sk_buff *skb, struct ifmcaddr6 *ifmca,
 		return -EMSGSIZE;
 
 	if (args->netnsid >= 0 &&
-	    nla_put_s32(skb, IFA_TARGET_NETNSID, args->netnsid))
+	    nla_put_s32(skb, IFA_TARGET_NETNSID, args->netnsid)) {
+		nlmsg_cancel(skb, nlh);
 		return -EMSGSIZE;
+	}
 
 	put_ifaddrmsg(nlh, 128, IFA_F_PERMANENT, scope, ifindex);
 	if (nla_put_in6_addr(skb, IFA_MULTICAST, &ifmca->mca_addr) < 0 ||
@@ -5055,8 +5057,10 @@ static int inet6_fill_ifacaddr(struct sk_buff *skb, struct ifacaddr6 *ifaca,
 		return -EMSGSIZE;
 
 	if (args->netnsid >= 0 &&
-	    nla_put_s32(skb, IFA_TARGET_NETNSID, args->netnsid))
+	    nla_put_s32(skb, IFA_TARGET_NETNSID, args->netnsid)) {
+		nlmsg_cancel(skb, nlh);
 		return -EMSGSIZE;
+	}
 
 	put_ifaddrmsg(nlh, 128, IFA_F_PERMANENT, scope, ifindex);
 	if (nla_put_in6_addr(skb, IFA_ANYCAST, &ifaca->aca_addr) < 0 ||
-- 
2.25.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] ipv6: Fix error path to cancel the meseage
  2020-11-12  8:09 [PATCH] ipv6: Fix error path to cancel the meseage Zhang Qilong
@ 2020-11-14  2:22 ` Jakub Kicinski
  2020-11-14  2:29   ` 答复: " zhangqilong
  0 siblings, 1 reply; 3+ messages in thread
From: Jakub Kicinski @ 2020-11-14  2:22 UTC (permalink / raw)
  To: Zhang Qilong; +Cc: davem, kuznet, yoshfuji, netdev

On Thu, 12 Nov 2020 16:09:50 +0800 Zhang Qilong wrote:
> genlmsg_cancel() needs to be called in the error path of
> inet6_fill_ifmcaddr and inet6_fill_ifacaddr to cancel
> the message.
> 
> Fixes: 203651b665f72 ("ipv6: add inet6_fill_args")
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Zhang Qilong <zhangqilong3@huawei.com>

This is the correct fixes tag:

Fixes: 6ecf4c37eb3e ("ipv6: enable IFA_TARGET_NETNSID for RTM_GETADDR") 

Applied.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* 答复: [PATCH] ipv6: Fix error path to cancel the meseage
  2020-11-14  2:22 ` Jakub Kicinski
@ 2020-11-14  2:29   ` zhangqilong
  0 siblings, 0 replies; 3+ messages in thread
From: zhangqilong @ 2020-11-14  2:29 UTC (permalink / raw)
  To: Jakub Kicinski; +Cc: davem, kuznet, yoshfuji, netdev

> 
> On Thu, 12 Nov 2020 16:09:50 +0800 Zhang Qilong wrote:
> > genlmsg_cancel() needs to be called in the error path of
> > inet6_fill_ifmcaddr and inet6_fill_ifacaddr to cancel the message.
> >
> > Fixes: 203651b665f72 ("ipv6: add inet6_fill_args")
> > Reported-by: Hulk Robot <hulkci@huawei.com>
> > Signed-off-by: Zhang Qilong <zhangqilong3@huawei.com>
> 
> This is the correct fixes tag:
> 
> Fixes: 6ecf4c37eb3e ("ipv6: enable IFA_TARGET_NETNSID for RTM_GETADDR")
> 
> Applied.

Yes, you are right.

Thanks,
Zhang

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-11-14  2:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-12  8:09 [PATCH] ipv6: Fix error path to cancel the meseage Zhang Qilong
2020-11-14  2:22 ` Jakub Kicinski
2020-11-14  2:29   ` 答复: " zhangqilong

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.