summaryrefslogtreecommitdiff
path: root/net/sctp
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@google.com>2018-04-30 05:54:58 -0700
committerGreg Kroah-Hartman <gregkh@google.com>2018-04-30 05:54:58 -0700
commit12ef385f51fecec81b6a690da98d9ee5bb96e887 (patch)
treea918e09f086840ad9407dd445bda5ebfe758f4cb /net/sctp
parent23eaecc37dfb0aa51cf131c32cb05784ef84d3be (diff)
parent34a220d573fcb5d66ad466611eb80f65b6af98d4 (diff)
Merge 4.4.130 into android-4.4
Changes in 4.4.130 cifs: do not allow creating sockets except with SMB1 posix exensions x86/tsc: Prevent 32bit truncation in calc_hpet_ref() perf: Return proper values for user stack errors staging: ion : Donnot wakeup kswapd in ion system alloc r8152: add Linksys USB3GIGV1 id Input: drv260x - fix initializing overdrive voltage ath9k_hw: check if the chip failed to wake up jbd2: fix use after free in kjournald2() Revert "ath10k: send (re)assoc peer command when NSS changed" s390: introduce CPU alternatives s390: enable CPU alternatives unconditionally KVM: s390: wire up bpb feature s390: scrub registers on kernel entry and KVM exit s390: add optimized array_index_mask_nospec s390/alternative: use a copy of the facility bit mask s390: add options to change branch prediction behaviour for the kernel s390: run user space and KVM guests with modified branch prediction s390: introduce execute-trampolines for branches s390: Replace IS_ENABLED(EXPOLINE_*) with IS_ENABLED(CONFIG_EXPOLINE_*) s390: do not bypass BPENTER for interrupt system calls s390/entry.S: fix spurious zeroing of r0 s390: move nobp parameter functions to nospec-branch.c s390: add automatic detection of the spectre defense s390: report spectre mitigation via syslog s390: add sysfs attributes for spectre s390: correct nospec auto detection init order s390: correct module section names for expoline code revert bonding: do not set slave_dev npinfo before slave_enable_netpoll in bond_enslave KEYS: DNS: limit the length of option strings l2tp: check sockaddr length in pppol2tp_connect() net: validate attribute sizes in neigh_dump_table() llc: delete timers synchronously in llc_sk_free() tcp: don't read out-of-bounds opsize team: avoid adding twice the same option to the event list team: fix netconsole setup over team packet: fix bitfield update race pppoe: check sockaddr length in pppoe_connect() vlan: Fix reading memory beyond skb->tail in skb_vlan_tagged_multi sctp: do not check port in sctp_inet6_cmp_addr llc: hold llc_sap before release_sock() llc: fix NULL pointer deref for SOCK_ZAPPED tipc: add policy for TIPC_NLA_NET_ADDR net: fix deadlock while clearing neighbor proxy table tcp: md5: reject TCP_MD5SIG or TCP_MD5SIG_EXT on established sockets net: af_packet: fix race in PACKET_{R|T}X_RING ipv6: add RTA_TABLE and RTA_PREFSRC to rtm_ipv6_policy scsi: mptsas: Disable WRITE SAME cdrom: information leak in cdrom_ioctl_media_changed() s390/cio: update chpid descriptor after resource accessibility event s390/uprobes: implement arch_uretprobe_is_alive() Linux 4.4.130 Change-Id: I58646180c70ac61da3e2a602085760881d914eb5 Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Diffstat (limited to 'net/sctp')
-rw-r--r--net/sctp/ipv6.c60
1 files changed, 30 insertions, 30 deletions
diff --git a/net/sctp/ipv6.c b/net/sctp/ipv6.c
index edb8514b4e00..1cd7b7e33fa3 100644
--- a/net/sctp/ipv6.c
+++ b/net/sctp/ipv6.c
@@ -519,46 +519,49 @@ static void sctp_v6_to_addr(union sctp_addr *addr, struct in6_addr *saddr,
addr->v6.sin6_scope_id = 0;
}
-/* Compare addresses exactly.
- * v4-mapped-v6 is also in consideration.
- */
-static int sctp_v6_cmp_addr(const union sctp_addr *addr1,
- const union sctp_addr *addr2)
+static int __sctp_v6_cmp_addr(const union sctp_addr *addr1,
+ const union sctp_addr *addr2)
{
if (addr1->sa.sa_family != addr2->sa.sa_family) {
if (addr1->sa.sa_family == AF_INET &&
addr2->sa.sa_family == AF_INET6 &&
- ipv6_addr_v4mapped(&addr2->v6.sin6_addr)) {
- if (addr2->v6.sin6_port == addr1->v4.sin_port &&
- addr2->v6.sin6_addr.s6_addr32[3] ==
- addr1->v4.sin_addr.s_addr)
- return 1;
- }
+ ipv6_addr_v4mapped(&addr2->v6.sin6_addr) &&
+ addr2->v6.sin6_addr.s6_addr32[3] ==
+ addr1->v4.sin_addr.s_addr)
+ return 1;
+
if (addr2->sa.sa_family == AF_INET &&
addr1->sa.sa_family == AF_INET6 &&
- ipv6_addr_v4mapped(&addr1->v6.sin6_addr)) {
- if (addr1->v6.sin6_port == addr2->v4.sin_port &&
- addr1->v6.sin6_addr.s6_addr32[3] ==
- addr2->v4.sin_addr.s_addr)
- return 1;
- }
+ ipv6_addr_v4mapped(&addr1->v6.sin6_addr) &&
+ addr1->v6.sin6_addr.s6_addr32[3] ==
+ addr2->v4.sin_addr.s_addr)
+ return 1;
+
return 0;
}
- if (addr1->v6.sin6_port != addr2->v6.sin6_port)
- return 0;
+
if (!ipv6_addr_equal(&addr1->v6.sin6_addr, &addr2->v6.sin6_addr))
return 0;
+
/* If this is a linklocal address, compare the scope_id. */
- if (ipv6_addr_type(&addr1->v6.sin6_addr) & IPV6_ADDR_LINKLOCAL) {
- if (addr1->v6.sin6_scope_id && addr2->v6.sin6_scope_id &&
- (addr1->v6.sin6_scope_id != addr2->v6.sin6_scope_id)) {
- return 0;
- }
- }
+ if ((ipv6_addr_type(&addr1->v6.sin6_addr) & IPV6_ADDR_LINKLOCAL) &&
+ addr1->v6.sin6_scope_id && addr2->v6.sin6_scope_id &&
+ addr1->v6.sin6_scope_id != addr2->v6.sin6_scope_id)
+ return 0;
return 1;
}
+/* Compare addresses exactly.
+ * v4-mapped-v6 is also in consideration.
+ */
+static int sctp_v6_cmp_addr(const union sctp_addr *addr1,
+ const union sctp_addr *addr2)
+{
+ return __sctp_v6_cmp_addr(addr1, addr2) &&
+ addr1->v6.sin6_port == addr2->v6.sin6_port;
+}
+
/* Initialize addr struct to INADDR_ANY. */
static void sctp_v6_inaddr_any(union sctp_addr *addr, __be16 port)
{
@@ -843,8 +846,8 @@ static int sctp_inet6_cmp_addr(const union sctp_addr *addr1,
const union sctp_addr *addr2,
struct sctp_sock *opt)
{
- struct sctp_af *af1, *af2;
struct sock *sk = sctp_opt2sk(opt);
+ struct sctp_af *af1, *af2;
af1 = sctp_get_af_specific(addr1->sa.sa_family);
af2 = sctp_get_af_specific(addr2->sa.sa_family);
@@ -860,10 +863,7 @@ static int sctp_inet6_cmp_addr(const union sctp_addr *addr1,
if (sctp_is_any(sk, addr1) || sctp_is_any(sk, addr2))
return 1;
- if (addr1->sa.sa_family != addr2->sa.sa_family)
- return 0;
-
- return af1->cmp_addr(addr1, addr2);
+ return __sctp_v6_cmp_addr(addr1, addr2);
}
/* Verify that the provided sockaddr looks bindable. Common verification,