netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] sctp: do not leak chunks that are sent to unconfirmed paths
@ 2016-03-18 21:39 Marcelo Ricardo Leitner
  2016-03-20 20:31 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Marcelo Ricardo Leitner @ 2016-03-18 21:39 UTC (permalink / raw)
  To: netdev; +Cc: Neil Horman, Vlad Yasevich, linux-sctp

Currently, if a chunk is scheduled to be sent through a transport that
is currently unconfirmed, it will be leaked as it is dequeued from outq
and is not re-queued nor freed.

As I'm not aware of any situation that may lead to this situation, I'm
fixing this by freeing the chunk and also logging a trace so that we can
fix the other bug if it ever happens.

Signed-off-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
---
 net/sctp/outqueue.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/net/sctp/outqueue.c b/net/sctp/outqueue.c
index f03541d0f12d052d1f58901d57852be46f18a15a..8d3d3625130ee0fd294998554a9290d57eae56e7 100644
--- a/net/sctp/outqueue.c
+++ b/net/sctp/outqueue.c
@@ -978,8 +978,12 @@ static int sctp_outq_flush(struct sctp_outq *q, int rtx_timeout, gfp_t gfp)
 			     (new_transport->state == SCTP_UNCONFIRMED) ||
 			     (new_transport->state == SCTP_PF)))
 				new_transport = asoc->peer.active_path;
-			if (new_transport->state == SCTP_UNCONFIRMED)
+			if (new_transport->state == SCTP_UNCONFIRMED) {
+				WARN_ONCE(1, "Atempt to send packet on unconfirmed path.");
+				sctp_chunk_fail(chunk, 0);
+				sctp_chunk_free(chunk);
 				continue;
+			}
 
 			/* Change packets if necessary.  */
 			if (new_transport != transport) {
-- 
2.5.0

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] sctp: do not leak chunks that are sent to unconfirmed paths
  2016-03-18 21:39 [PATCH] sctp: do not leak chunks that are sent to unconfirmed paths Marcelo Ricardo Leitner
@ 2016-03-20 20:31 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2016-03-20 20:31 UTC (permalink / raw)
  To: marcelo.leitner; +Cc: netdev, nhorman, vyasevich, linux-sctp

From: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Date: Fri, 18 Mar 2016 18:39:19 -0300

> Currently, if a chunk is scheduled to be sent through a transport that
> is currently unconfirmed, it will be leaked as it is dequeued from outq
> and is not re-queued nor freed.
> 
> As I'm not aware of any situation that may lead to this situation, I'm
> fixing this by freeing the chunk and also logging a trace so that we can
> fix the other bug if it ever happens.
> 
> Signed-off-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>

Applied.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-03-20 20:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-18 21:39 [PATCH] sctp: do not leak chunks that are sent to unconfirmed paths Marcelo Ricardo Leitner
2016-03-20 20:31 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).