Skip to contentSkip to conversation

Patch "sctp: check af before verify address in sctp_addr_id2transport" has been added to the 4.4-stable tree

PATCH [email protected] 1 participant 1 message Jul 3, 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: check af before verify address in sctp_addr_id2transport

to the 4.4-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-check-af-before-verify-address-in-sctp_addr_id2transport.patch
and it can be found in the queue-4.4 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 Mon Jul 3 13:41:44 CEST 2017

From: Xin Long <[email protected]>
Date: Tue, 7 Feb 2017 20:56:08 +0800
Subject: sctp: check af before verify address in sctp_addr_id2transport

From: Xin Long <[email protected]>

[ Upstream commit 912964eacb111551db73429719eb5fadcab0ff8a ]

Commit 6f29a1306131 ("sctp: sctp_addr_id2transport should verify the addr before looking up assoc") invoked sctp_verify_addr to verify the addr.

But it didn't check af variable beforehand, once users pass an address with family = 0 through sockopt, sctp_get_af_specific will return NULL and NULL pointer dereference will be caused by af->sockaddr_len.

This patch is to fix it by returning NULL if af variable is NULL.

Fixes 6f29a1306131 ("sctp: sctp_addr_id2transport should verify the addr before looking up assoc")
---
 net/sctp/socket.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/sctp/socket.c +1 -1
@@ -239,7 +239,7 @@ static struct sctp_transport *sctp_addr_
 	union sctp_addr *laddr = (union sctp_addr *)addr;
 	struct sctp_transport *transport;
 
-	if (sctp_verify_addr(sk, laddr, af->sockaddr_len))
+	if (!af || sctp_verify_addr(sk, laddr, af->sockaddr_len))
 		return NULL;
 
 	addr_asoc = sctp_endpoint_lookup_assoc(sctp_sk(sk)->ep,

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

queue-4.4/ipv6-fix-calling-in6_ifa_hold-incorrectly-for-dad-work.patch queue-4.4/igmp-acquire-pmc-lock-for-ip_mc_clear_src.patch queue-4.4/sctp-check-af-before-verify-address-in-sctp_addr_id2transport.patch