Commit da027ec9 authored by Pavel Emelyanov's avatar Pavel Emelyanov Committed by Greg Kroah-Hartman

DECNET: dn_nl_deladdr() almost always returns no error

[DECNET]: dn_nl_deladdr() almost always returns no error

[ Upstream commit: 3ccd8624 ]

As far as I see from the err variable initialization
the dn_nl_deladdr() routine was designed to report errors
like "EADDRNOTAVAIL" and probaby "ENODEV".

But the code sets this err to 0 after the first nlmsg_parse
and goes on, returning this 0 in any case.
Signed-off-by: default avatarPavel Emelyanov <xemul@openvz.org>
Acked-by: default avatarSteven Whitehouse <swhiteho@redhat.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent c8ddbf10
...@@ -650,16 +650,18 @@ static int dn_nl_deladdr(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg) ...@@ -650,16 +650,18 @@ static int dn_nl_deladdr(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
struct dn_dev *dn_db; struct dn_dev *dn_db;
struct ifaddrmsg *ifm; struct ifaddrmsg *ifm;
struct dn_ifaddr *ifa, **ifap; struct dn_ifaddr *ifa, **ifap;
int err = -EADDRNOTAVAIL; int err;
err = nlmsg_parse(nlh, sizeof(*ifm), tb, IFA_MAX, dn_ifa_policy); err = nlmsg_parse(nlh, sizeof(*ifm), tb, IFA_MAX, dn_ifa_policy);
if (err < 0) if (err < 0)
goto errout; goto errout;
err = -ENODEV;
ifm = nlmsg_data(nlh); ifm = nlmsg_data(nlh);
if ((dn_db = dn_dev_by_index(ifm->ifa_index)) == NULL) if ((dn_db = dn_dev_by_index(ifm->ifa_index)) == NULL)
goto errout; goto errout;
err = -EADDRNOTAVAIL;
for (ifap = &dn_db->ifa_list; (ifa = *ifap); ifap = &ifa->ifa_next) { for (ifap = &dn_db->ifa_list; (ifa = *ifap); ifap = &ifa->ifa_next) {
if (tb[IFA_LOCAL] && if (tb[IFA_LOCAL] &&
nla_memcmp(tb[IFA_LOCAL], &ifa->ifa_local, 2)) nla_memcmp(tb[IFA_LOCAL], &ifa->ifa_local, 2))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment