[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20150614.125601.1919783457395979333.davem@davemloft.net>
Date: Sun, 14 Jun 2015 12:56:01 -0700 (PDT)
From: David Miller <davem@...emloft.net>
To: marcelo.leitner@...il.com
Cc: nhorman@...driver.com, hannes@...essinduktion.org,
netdev@...r.kernel.org, linux-sctp@...r.kernel.org,
daniel@...earbox.net, vyasevich@...il.com, micchie@....wide.ad.jp
Subject: Re: [PATCH v5] sctp: fix ASCONF list handling
From: marcelo.leitner@...il.com
Date: Fri, 12 Jun 2015 10:16:41 -0300
> From: Marcelo Ricardo Leitner <marcelo.leitner@...il.com>
>
> ->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).")
> Reported-by: Ji Jianwen <jiji@...hat.com>
> Suggested-by: Neil Horman <nhorman@...driver.com>
> Suggested-by: Hannes Frederic Sowa <hannes@...essinduktion.org>
> Acked-by: Hannes Frederic Sowa <hannes@...essinduktion.org>
> Signed-off-by: Marcelo Ricardo Leitner <marcelo.leitner@...il.com>
Applied, thank you.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists