Skip to contentSkip to conversation

Patch "sctp: sctp_addr_id2transport should verify the addr before looking up assoc" has been added to the 4.9-stable tree

PATCH [email protected] 1 participant 1 message Jun 15, 2017

Subsystems (3)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

sctp: sctp_addr_id2transport should verify the addr before looking up assoc

to the 4.9-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
sctp-sctp_addr_id2transport-should-verify-the-addr-before-looking-up-assoc.patch
and it can be found in the queue-4.9 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From foo@baz Thu Jun 15 16:23:30 CEST 2017

From: Xin Long <[email protected]>
Date: Tue, 24 Jan 2017 14:01:53 +0800
Subject: sctp: sctp_addr_id2transport should verify the addr before looking up assoc

From: Xin Long <[email protected]>

[ Upstream commit 6f29a130613191d3c6335169febe002cba00edf5 ]

sctp_addr_id2transport is a function for sockopt to look up assoc by address. As the address is from userspace, it can be a v4-mapped v6 address. But in sctp protocol stack, it always handles a v4-mapped v6 address as a v4 address. So it's necessary to convert it to a v4 address before looking up assoc by address.

This patch is to fix it by calling sctp_verify_addr in which it can do this conversion before calling sctp_endpoint_lookup_assoc, just like what sctp_sendmsg and __sctp_connect do for the address from users.

---
 net/sctp/socket.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
net/sctp/socket.c +5 -1
@@ -235,8 +235,12 @@ static struct sctp_transport *sctp_addr_
 					      sctp_assoc_t id)
 {
 	struct sctp_association *addr_asoc = NULL, *id_asoc = NULL;
-	struct sctp_transport *transport;
+	struct sctp_af *af = sctp_get_af_specific(addr->ss_family);
 	union sctp_addr *laddr = (union sctp_addr *)addr;
+	struct sctp_transport *transport;
+
+	if (sctp_verify_addr(sk, laddr, af->sockaddr_len))
+		return NULL;
 
 	addr_asoc = sctp_endpoint_lookup_assoc(sctp_sk(sk)->ep,
 					       laddr,

Patches currently in stable-queue which might be from [email protected] are

queue-4.9/sctp-sctp-gso-should-set-feature-with-netif_f_sg-when-calling-skb_segment.patch queue-4.9/sctp-sctp_addr_id2transport-should-verify-the-addr-before-looking-up-assoc.patch