|
@@ -2932,6 +2932,7 @@ static int sctp_setsockopt_peer_primary_addr(struct sock *sk, char __user *optva
|
|
struct sctp_association *asoc = NULL;
|
|
struct sctp_association *asoc = NULL;
|
|
struct sctp_setpeerprim prim;
|
|
struct sctp_setpeerprim prim;
|
|
struct sctp_chunk *chunk;
|
|
struct sctp_chunk *chunk;
|
|
|
|
+ struct sctp_af *af;
|
|
int err;
|
|
int err;
|
|
|
|
|
|
sp = sctp_sk(sk);
|
|
sp = sctp_sk(sk);
|
|
@@ -2959,6 +2960,13 @@ static int sctp_setsockopt_peer_primary_addr(struct sock *sk, char __user *optva
|
|
if (!sctp_state(asoc, ESTABLISHED))
|
|
if (!sctp_state(asoc, ESTABLISHED))
|
|
return -ENOTCONN;
|
|
return -ENOTCONN;
|
|
|
|
|
|
|
|
+ af = sctp_get_af_specific(prim.sspp_addr.ss_family);
|
|
|
|
+ if (!af)
|
|
|
|
+ return -EINVAL;
|
|
|
|
+
|
|
|
|
+ if (!af->addr_valid((union sctp_addr *)&prim.sspp_addr, sp, NULL))
|
|
|
|
+ return -EADDRNOTAVAIL;
|
|
|
|
+
|
|
if (!sctp_assoc_lookup_laddr(asoc, (union sctp_addr *)&prim.sspp_addr))
|
|
if (!sctp_assoc_lookup_laddr(asoc, (union sctp_addr *)&prim.sspp_addr))
|
|
return -EADDRNOTAVAIL;
|
|
return -EADDRNOTAVAIL;
|
|
|
|
|