All of lore.kernel.org
 help / color / mirror / Atom feed
From: Evgeniy Polyakov <johnpol@2ka.mipt.ru>
To: Frank van Maarseveen <frankvm@frankvm.com>
Cc: netdev@vger.kernel.org
Subject: Re: 2.6.19/2.6.20 BUG in inet_rtm_newaddr()/__inet_insert_ifa()
Date: Fri, 9 Mar 2007 15:30:17 +0300	[thread overview]
Message-ID: <20070309123016.GA4736@2ka.mipt.ru> (raw)
In-Reply-To: <20070309103333.GA17232@janus>

On Fri, Mar 09, 2007 at 11:33:33AM +0100, Frank van Maarseveen (frankvm@frankvm.com) wrote:
> Try this:
> 
> ip addr add 172.18.12.99/21 dev dummy0
> ip addr add broadcast 172.18.15.255 dev dummy0

Attached patch fixes the problem.

nlmsg_parse() in rtm_to_ifaddr() sucessfully returns zero, but
subsequent check for prefix len and LOCAL ifa fails, so NULL is returned
instead of negative error value embedded in the pointer which is
expected by error logic in inet_rtm_newaddr().

---

Return negative error value (embedded in the pointer) instead of returning NULL.

Signed-off-by: Evgeniy Polyakov <johnpol@2ka.mipt.ru>

diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
index e10794d..98a00d0 100644
--- a/net/ipv4/devinet.c
+++ b/net/ipv4/devinet.c
@@ -502,8 +502,10 @@ static struct in_ifaddr *rtm_to_ifaddr(struct nlmsghdr *nlh)
 		goto errout;
 
 	ifm = nlmsg_data(nlh);
-	if (ifm->ifa_prefixlen > 32 || tb[IFA_LOCAL] == NULL)
+	if (ifm->ifa_prefixlen > 32 || tb[IFA_LOCAL] == NULL) {
+		err = -EINVAL;
 		goto errout;
+	}
 
 	dev = __dev_get_by_index(ifm->ifa_index);
 	if (dev == NULL) {

-- 
	Evgeniy Polyakov

  reply	other threads:[~2007-03-09 12:31 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-09 10:33 2.6.19/2.6.20 BUG in inet_rtm_newaddr()/__inet_insert_ifa() Frank van Maarseveen
2007-03-09 12:30 ` Evgeniy Polyakov [this message]
2007-03-09 18:22   ` Frank van Maarseveen
2007-03-10 13:19     ` Evgeniy Polyakov
2007-03-10 13:55       ` Frank van Maarseveen
2007-03-09 21:43   ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070309123016.GA4736@2ka.mipt.ru \
    --to=johnpol@2ka.mipt.ru \
    --cc=frankvm@frankvm.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.