SCTP: Add scope_id validation for link-local binds
authorVlad Yasevich <vladislav.yasevich@hp.com>
Tue, 3 Jul 2007 18:29:23 +0000 (14:29 -0400)
committerDavid S. Miller <davem@sunset.davemloft.net>
Fri, 6 Jul 2007 00:40:15 +0000 (17:40 -0700)
SCTP currently permits users to bind to link-local addresses,
but doesn't verify that the scope id specified at bind matches
the interface that the address is configured on.  It was report
that this can hang a system.

Signed-off-by: Vlad Yasevich <vladislav.yasevich@hp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/sctp/ipv6.c

index 84cd53635fe8f8499b8b37ba188857ec00b05f03..2c29394fd92ebf4367a24d7bb8883b657832c10f 100644 (file)
@@ -844,6 +844,10 @@ static int sctp_inet6_bind_verify(struct sctp_sock *opt, union sctp_addr *addr)
                        dev = dev_get_by_index(addr->v6.sin6_scope_id);
                        if (!dev)
                                return 0;
+                       if (!ipv6_chk_addr(&addr->v6.sin6_addr, dev, 0)) {
+                               dev_put(dev);
+                               return 0;
+                       }
                        dev_put(dev);
                }
                af = opt->pf->af;