[IPV6]: return EINVAL for invalid address with flowlabel lease request
authorJames Morris <jmorris@namei.org>
Tue, 31 Oct 2006 02:56:06 +0000 (18:56 -0800)
committerDavid S. Miller <davem@davemloft.net>
Tue, 31 Oct 2006 02:56:06 +0000 (18:56 -0800)
Currently, when an application requests a lease for a flowlabel via the
IPV6_FLOWLABEL_MGR socket option, no error is returned if an invalid type
of destination address is supplied as part of the request, leading to a
silent failure.  This patch ensures that EINVAL is returned to the
application in this case.

Signed-off-by: James Morris <jmorris@namei.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv6/ip6_flowlabel.c

index 062e526a668c511406ceeeec85fb379b52cfc568..2b45f2d657c2bc383bbc418b0cf8c0992e8be918 100644 (file)
@@ -330,8 +330,10 @@ fl_create(struct in6_flowlabel_req *freq, char __user *optval, int optlen, int *
        fl->share = freq->flr_share;
        addr_type = ipv6_addr_type(&freq->flr_dst);
        if ((addr_type&IPV6_ADDR_MAPPED)
-           || addr_type == IPV6_ADDR_ANY)
+           || addr_type == IPV6_ADDR_ANY) {
+               err = -EINVAL;
                goto done;
+       }
        ipv6_addr_copy(&fl->dst, &freq->flr_dst);
        atomic_set(&fl->users, 1);
        switch (fl->share) {