Skip to contentSkip to conversation

CVE-2015-3212

PATCH New Wang Kai 1 participant 2 messages Sep 7, 2015

Subsystems (3)
lore
Share & tools
lore

Wang Kai

author
#0 lore raw

PATCH 1/1 CVE-2015-3212

Hi, Greg

The following patch fix CVE-2015-3212, upstream commit is 2d45a02d01. Could you apply it to 3.10?

BTW, when will be the EOL of 3.10, End of September? Any more release?

Marcelo Ricardo Leitner (1):
sctp: fix ASCONF list handling

 include/net/netns/sctp.h   |  1 +
 include/net/sctp/structs.h |  4 ++++
 net/sctp/socket.c          | 43 ++++++++++++++++++++++++++++++++-----------
 3 files changed, 37 insertions(+), 11 deletions(-)
Signature · 1 line
1.8.3.4
author
#1 lore raw

PATCH 1/1 sctp: fix ASCONF list handling

From: Marcelo Ricardo Leitner <[email protected]>

commit 2d45a02d0166caf2627fe91897c6ffc3b19514c4 upstream.

->auto_asconf_splist is per namespace and mangled by functions like sctp_setsockopt_auto_asconf() which doesn't guarantee any serialization.

Also, the call to inet_sk_copy_descendant() was backuping ->auto_asconf_list through the copy but was not honoring ->do_auto_asconf, which could lead to list corruption if it was different between both sockets.

This commit thus fixes the list handling by using ->addr_wq_lock spinlock to protect the list. A special handling is done upon socket creation and destruction for that. Error handlig on sctp_init_sock() will never return an error after having initialized asconf, so sctp_destroy_sock() can be called without addrq_wq_lock. The lock now will be take on sctp_close_sock(), before locking the socket, so we don't do it in inverse order compared to sctp_addr_wq_timeout_handler().

Instead of taking the lock on sctp_sock_migrate() for copying and restoring the list values, it's preferred to avoid rewritting it by implementing sctp_copy_descendant().

Issue was found with a test application that kept flipping sysctl default_auto_asconf on and off, but one could trigger it by issuing simultaneous setsockopt() calls on multiple sockets or by creating/destroying sockets fast enough. This is only triggerable locally.

Fixes 9f7d653b67ae ("sctp: Add Auto-ASCONF support (core).")
[wangkai: backport to 3.10: adjust context]
---
 include/net/netns/sctp.h   |  1 +
 include/net/sctp/structs.h |  4 ++++
 net/sctp/socket.c          | 43 ++++++++++++++++++++++++++++++++-----------
 3 files changed, 37 insertions(+), 11 deletions(-)
include/net/netns/sctp.h +1 -0
index 3573a81..8ba379f 100644
@@ -31,6 +31,7 @@ struct netns_sctp {
 	struct list_head addr_waitq;
 	struct timer_list addr_wq_timer;
 	struct list_head auto_asconf_splist;
+	/* Lock that protects both addr_waitq and auto_asconf_splist */
 	spinlock_t addr_wq_lock;
 
 	/* Lock that protects the local_addr_list writers */
include/net/sctp/structs.h +4 -0
index da6b9a0..b30c1d9 100644
@@ -228,6 +228,10 @@ struct sctp_sock {
 	atomic_t pd_mode;
 	/* Receive to here while partial delivery is in effect. */
 	struct sk_buff_head pd_lobby;
+
+	/* These must be the last fields, as they will skipped on copies,
+	 * like on accept and peeloff operations
+	 */
 	struct list_head auto_asconf_list;
 	int do_auto_asconf;
 };
net/sctp/socket.c +32 -11

102 lines not on this page · raw message

Signature · 1 line
1.8.3.4