linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net/ipv6: Fix a test against 'ipv6_find_idev()' return value
@ 2018-12-28 22:28 Christophe JAILLET
  2018-12-30 20:33 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Christophe JAILLET @ 2018-12-28 22:28 UTC (permalink / raw)
  To: davem, kuznet, yoshfuji, sd
  Cc: netdev, linux-kernel, kernel-janitors, Christophe JAILLET

'ipv6_find_idev()' returns NULL on error, not an error pointer.
Update the test accordingly and return -ENOBUFS, as already done in
'addrconf_add_dev()', if NULL is returned.

Fixes: ("ipv6: allow userspace to add IFA_F_OPTIMISTIC addresses")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
 net/ipv6/addrconf.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 521e471f1cf9..8eeec6eb2bd3 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -4736,8 +4736,8 @@ inet6_rtm_newaddr(struct sk_buff *skb, struct nlmsghdr *nlh,
 			 IFA_F_MCAUTOJOIN | IFA_F_OPTIMISTIC;
 
 	idev = ipv6_find_idev(dev);
-	if (IS_ERR(idev))
-		return PTR_ERR(idev);
+	if (!idev)
+		return -ENOBUFS;
 
 	if (!ipv6_allow_optimistic_dad(net, idev))
 		cfg.ifa_flags &= ~IFA_F_OPTIMISTIC;
-- 
2.19.1


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

* Re: [PATCH] net/ipv6: Fix a test against 'ipv6_find_idev()' return value
  2018-12-28 22:28 [PATCH] net/ipv6: Fix a test against 'ipv6_find_idev()' return value Christophe JAILLET
@ 2018-12-30 20:33 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2018-12-30 20:33 UTC (permalink / raw)
  To: christophe.jaillet
  Cc: kuznet, yoshfuji, sd, netdev, linux-kernel, kernel-janitors

From: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Date: Fri, 28 Dec 2018 23:28:21 +0100

> 'ipv6_find_idev()' returns NULL on error, not an error pointer.
> Update the test accordingly and return -ENOBUFS, as already done in
> 'addrconf_add_dev()', if NULL is returned.
> 
> Fixes: ("ipv6: allow userspace to add IFA_F_OPTIMISTIC addresses")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>

Applied and queued up for -stable.

Please provide the SHA1_ID in the Fixes: tag next time, I fixed it up
for you.

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

end of thread, other threads:[~2018-12-30 20:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-28 22:28 [PATCH] net/ipv6: Fix a test against 'ipv6_find_idev()' return value Christophe JAILLET
2018-12-30 20:33 ` David Miller

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).