All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net] sctp: use right member as the param of list_for_each_entry
@ 2017-11-26 12:56 ` Xin Long
  0 siblings, 0 replies; 8+ messages in thread
From: Xin Long @ 2017-11-26 12:56 UTC (permalink / raw)
  To: network dev, linux-sctp; +Cc: davem, Marcelo Ricardo Leitner, Neil Horman

Commit d04adf1b3551 ("sctp: reset owner sk for data chunks on out queues
when migrating a sock") made a mistake that using 'list' as the param of
list_for_each_entry to traverse the retransmit, sacked and abandoned
queues, while chunks are using 'transmitted_list' to link into these
queues.

It could cause NULL dereference panic if there are chunks in any of these
queues when peeling off one asoc.

So use the chunk member 'transmitted_list' instead in this patch.

Fixes: d04adf1b3551 ("sctp: reset owner sk for data chunks on out queues when migrating a sock")
Signed-off-by: Xin Long <lucien.xin@gmail.com>
---
 net/sctp/socket.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index 3204a9b..014847e 100644
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -188,13 +188,13 @@ static void sctp_for_each_tx_datachunk(struct sctp_association *asoc,
 		list_for_each_entry(chunk, &t->transmitted, transmitted_list)
 			cb(chunk);
 
-	list_for_each_entry(chunk, &q->retransmit, list)
+	list_for_each_entry(chunk, &q->retransmit, transmitted_list)
 		cb(chunk);
 
-	list_for_each_entry(chunk, &q->sacked, list)
+	list_for_each_entry(chunk, &q->sacked, transmitted_list)
 		cb(chunk);
 
-	list_for_each_entry(chunk, &q->abandoned, list)
+	list_for_each_entry(chunk, &q->abandoned, transmitted_list)
 		cb(chunk);
 
 	list_for_each_entry(chunk, &q->out_chunk_list, list)
-- 
2.1.0

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

* [PATCH net] sctp: use right member as the param of list_for_each_entry
@ 2017-11-26 12:56 ` Xin Long
  0 siblings, 0 replies; 8+ messages in thread
From: Xin Long @ 2017-11-26 12:56 UTC (permalink / raw)
  To: network dev, linux-sctp; +Cc: davem, Marcelo Ricardo Leitner, Neil Horman

Commit d04adf1b3551 ("sctp: reset owner sk for data chunks on out queues
when migrating a sock") made a mistake that using 'list' as the param of
list_for_each_entry to traverse the retransmit, sacked and abandoned
queues, while chunks are using 'transmitted_list' to link into these
queues.

It could cause NULL dereference panic if there are chunks in any of these
queues when peeling off one asoc.

So use the chunk member 'transmitted_list' instead in this patch.

Fixes: d04adf1b3551 ("sctp: reset owner sk for data chunks on out queues when migrating a sock")
Signed-off-by: Xin Long <lucien.xin@gmail.com>
---
 net/sctp/socket.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index 3204a9b..014847e 100644
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -188,13 +188,13 @@ static void sctp_for_each_tx_datachunk(struct sctp_association *asoc,
 		list_for_each_entry(chunk, &t->transmitted, transmitted_list)
 			cb(chunk);
 
-	list_for_each_entry(chunk, &q->retransmit, list)
+	list_for_each_entry(chunk, &q->retransmit, transmitted_list)
 		cb(chunk);
 
-	list_for_each_entry(chunk, &q->sacked, list)
+	list_for_each_entry(chunk, &q->sacked, transmitted_list)
 		cb(chunk);
 
-	list_for_each_entry(chunk, &q->abandoned, list)
+	list_for_each_entry(chunk, &q->abandoned, transmitted_list)
 		cb(chunk);
 
 	list_for_each_entry(chunk, &q->out_chunk_list, list)
-- 
2.1.0


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

* Re: [PATCH net] sctp: use right member as the param of list_for_each_entry
  2017-11-26 12:56 ` Xin Long
@ 2017-11-27 12:45   ` Marcelo Ricardo Leitner
  -1 siblings, 0 replies; 8+ messages in thread
From: Marcelo Ricardo Leitner @ 2017-11-27 12:45 UTC (permalink / raw)
  To: Xin Long; +Cc: network dev, linux-sctp, davem, Neil Horman

On Sun, Nov 26, 2017 at 08:56:07PM +0800, Xin Long wrote:
> Commit d04adf1b3551 ("sctp: reset owner sk for data chunks on out queues
> when migrating a sock") made a mistake that using 'list' as the param of
> list_for_each_entry to traverse the retransmit, sacked and abandoned
> queues, while chunks are using 'transmitted_list' to link into these
> queues.
> 
> It could cause NULL dereference panic if there are chunks in any of these
> queues when peeling off one asoc.
> 
> So use the chunk member 'transmitted_list' instead in this patch.
> 
> Fixes: d04adf1b3551 ("sctp: reset owner sk for data chunks on out queues when migrating a sock")
> Signed-off-by: Xin Long <lucien.xin@gmail.com>

Ouch

Acked-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>

> ---
>  net/sctp/socket.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/net/sctp/socket.c b/net/sctp/socket.c
> index 3204a9b..014847e 100644
> --- a/net/sctp/socket.c
> +++ b/net/sctp/socket.c
> @@ -188,13 +188,13 @@ static void sctp_for_each_tx_datachunk(struct sctp_association *asoc,
>  		list_for_each_entry(chunk, &t->transmitted, transmitted_list)
>  			cb(chunk);
>  
> -	list_for_each_entry(chunk, &q->retransmit, list)
> +	list_for_each_entry(chunk, &q->retransmit, transmitted_list)
>  		cb(chunk);
>  
> -	list_for_each_entry(chunk, &q->sacked, list)
> +	list_for_each_entry(chunk, &q->sacked, transmitted_list)
>  		cb(chunk);
>  
> -	list_for_each_entry(chunk, &q->abandoned, list)
> +	list_for_each_entry(chunk, &q->abandoned, transmitted_list)
>  		cb(chunk);
>  
>  	list_for_each_entry(chunk, &q->out_chunk_list, list)
> -- 
> 2.1.0
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-sctp" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

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

* Re: [PATCH net] sctp: use right member as the param of list_for_each_entry
@ 2017-11-27 12:45   ` Marcelo Ricardo Leitner
  0 siblings, 0 replies; 8+ messages in thread
From: Marcelo Ricardo Leitner @ 2017-11-27 12:45 UTC (permalink / raw)
  To: Xin Long; +Cc: network dev, linux-sctp, davem, Neil Horman

On Sun, Nov 26, 2017 at 08:56:07PM +0800, Xin Long wrote:
> Commit d04adf1b3551 ("sctp: reset owner sk for data chunks on out queues
> when migrating a sock") made a mistake that using 'list' as the param of
> list_for_each_entry to traverse the retransmit, sacked and abandoned
> queues, while chunks are using 'transmitted_list' to link into these
> queues.
> 
> It could cause NULL dereference panic if there are chunks in any of these
> queues when peeling off one asoc.
> 
> So use the chunk member 'transmitted_list' instead in this patch.
> 
> Fixes: d04adf1b3551 ("sctp: reset owner sk for data chunks on out queues when migrating a sock")
> Signed-off-by: Xin Long <lucien.xin@gmail.com>

Ouch

Acked-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>

> ---
>  net/sctp/socket.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/net/sctp/socket.c b/net/sctp/socket.c
> index 3204a9b..014847e 100644
> --- a/net/sctp/socket.c
> +++ b/net/sctp/socket.c
> @@ -188,13 +188,13 @@ static void sctp_for_each_tx_datachunk(struct sctp_association *asoc,
>  		list_for_each_entry(chunk, &t->transmitted, transmitted_list)
>  			cb(chunk);
>  
> -	list_for_each_entry(chunk, &q->retransmit, list)
> +	list_for_each_entry(chunk, &q->retransmit, transmitted_list)
>  		cb(chunk);
>  
> -	list_for_each_entry(chunk, &q->sacked, list)
> +	list_for_each_entry(chunk, &q->sacked, transmitted_list)
>  		cb(chunk);
>  
> -	list_for_each_entry(chunk, &q->abandoned, list)
> +	list_for_each_entry(chunk, &q->abandoned, transmitted_list)
>  		cb(chunk);
>  
>  	list_for_each_entry(chunk, &q->out_chunk_list, list)
> -- 
> 2.1.0
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-sctp" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

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

* Re: [PATCH net] sctp: use right member as the param of list_for_each_entry
  2017-11-26 12:56 ` Xin Long
@ 2017-11-27 14:04   ` Neil Horman
  -1 siblings, 0 replies; 8+ messages in thread
From: Neil Horman @ 2017-11-27 14:04 UTC (permalink / raw)
  To: Xin Long; +Cc: network dev, linux-sctp, davem, Marcelo Ricardo Leitner

On Sun, Nov 26, 2017 at 08:56:07PM +0800, Xin Long wrote:
> Commit d04adf1b3551 ("sctp: reset owner sk for data chunks on out queues
> when migrating a sock") made a mistake that using 'list' as the param of
> list_for_each_entry to traverse the retransmit, sacked and abandoned
> queues, while chunks are using 'transmitted_list' to link into these
> queues.
> 
> It could cause NULL dereference panic if there are chunks in any of these
> queues when peeling off one asoc.
> 
> So use the chunk member 'transmitted_list' instead in this patch.
> 
> Fixes: d04adf1b3551 ("sctp: reset owner sk for data chunks on out queues when migrating a sock")
> Signed-off-by: Xin Long <lucien.xin@gmail.com>
> ---
>  net/sctp/socket.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/net/sctp/socket.c b/net/sctp/socket.c
> index 3204a9b..014847e 100644
> --- a/net/sctp/socket.c
> +++ b/net/sctp/socket.c
> @@ -188,13 +188,13 @@ static void sctp_for_each_tx_datachunk(struct sctp_association *asoc,
>  		list_for_each_entry(chunk, &t->transmitted, transmitted_list)
>  			cb(chunk);
>  
> -	list_for_each_entry(chunk, &q->retransmit, list)
> +	list_for_each_entry(chunk, &q->retransmit, transmitted_list)
>  		cb(chunk);
>  
> -	list_for_each_entry(chunk, &q->sacked, list)
> +	list_for_each_entry(chunk, &q->sacked, transmitted_list)
>  		cb(chunk);
>  
> -	list_for_each_entry(chunk, &q->abandoned, list)
> +	list_for_each_entry(chunk, &q->abandoned, transmitted_list)
>  		cb(chunk);
>  
>  	list_for_each_entry(chunk, &q->out_chunk_list, list)
> -- 
> 2.1.0
> 
> 
Acked-by: Neil Horman <nhorman@tuxdriver.com>

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

* Re: [PATCH net] sctp: use right member as the param of list_for_each_entry
@ 2017-11-27 14:04   ` Neil Horman
  0 siblings, 0 replies; 8+ messages in thread
From: Neil Horman @ 2017-11-27 14:04 UTC (permalink / raw)
  To: Xin Long; +Cc: network dev, linux-sctp, davem, Marcelo Ricardo Leitner

On Sun, Nov 26, 2017 at 08:56:07PM +0800, Xin Long wrote:
> Commit d04adf1b3551 ("sctp: reset owner sk for data chunks on out queues
> when migrating a sock") made a mistake that using 'list' as the param of
> list_for_each_entry to traverse the retransmit, sacked and abandoned
> queues, while chunks are using 'transmitted_list' to link into these
> queues.
> 
> It could cause NULL dereference panic if there are chunks in any of these
> queues when peeling off one asoc.
> 
> So use the chunk member 'transmitted_list' instead in this patch.
> 
> Fixes: d04adf1b3551 ("sctp: reset owner sk for data chunks on out queues when migrating a sock")
> Signed-off-by: Xin Long <lucien.xin@gmail.com>
> ---
>  net/sctp/socket.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/net/sctp/socket.c b/net/sctp/socket.c
> index 3204a9b..014847e 100644
> --- a/net/sctp/socket.c
> +++ b/net/sctp/socket.c
> @@ -188,13 +188,13 @@ static void sctp_for_each_tx_datachunk(struct sctp_association *asoc,
>  		list_for_each_entry(chunk, &t->transmitted, transmitted_list)
>  			cb(chunk);
>  
> -	list_for_each_entry(chunk, &q->retransmit, list)
> +	list_for_each_entry(chunk, &q->retransmit, transmitted_list)
>  		cb(chunk);
>  
> -	list_for_each_entry(chunk, &q->sacked, list)
> +	list_for_each_entry(chunk, &q->sacked, transmitted_list)
>  		cb(chunk);
>  
> -	list_for_each_entry(chunk, &q->abandoned, list)
> +	list_for_each_entry(chunk, &q->abandoned, transmitted_list)
>  		cb(chunk);
>  
>  	list_for_each_entry(chunk, &q->out_chunk_list, list)
> -- 
> 2.1.0
> 
> 
Acked-by: Neil Horman <nhorman@tuxdriver.com>

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

* Re: [PATCH net] sctp: use right member as the param of list_for_each_entry
  2017-11-26 12:56 ` Xin Long
@ 2017-11-28 20:56   ` David Miller
  -1 siblings, 0 replies; 8+ messages in thread
From: David Miller @ 2017-11-28 20:56 UTC (permalink / raw)
  To: lucien.xin; +Cc: netdev, linux-sctp, marcelo.leitner, nhorman

From: Xin Long <lucien.xin@gmail.com>
Date: Sun, 26 Nov 2017 20:56:07 +0800

> Commit d04adf1b3551 ("sctp: reset owner sk for data chunks on out queues
> when migrating a sock") made a mistake that using 'list' as the param of
> list_for_each_entry to traverse the retransmit, sacked and abandoned
> queues, while chunks are using 'transmitted_list' to link into these
> queues.
> 
> It could cause NULL dereference panic if there are chunks in any of these
> queues when peeling off one asoc.
> 
> So use the chunk member 'transmitted_list' instead in this patch.
> 
> Fixes: d04adf1b3551 ("sctp: reset owner sk for data chunks on out queues when migrating a sock")
> Signed-off-by: Xin Long <lucien.xin@gmail.com>

Applied and queued up for -stable.

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

* Re: [PATCH net] sctp: use right member as the param of list_for_each_entry
@ 2017-11-28 20:56   ` David Miller
  0 siblings, 0 replies; 8+ messages in thread
From: David Miller @ 2017-11-28 20:56 UTC (permalink / raw)
  To: lucien.xin; +Cc: netdev, linux-sctp, marcelo.leitner, nhorman

From: Xin Long <lucien.xin@gmail.com>
Date: Sun, 26 Nov 2017 20:56:07 +0800

> Commit d04adf1b3551 ("sctp: reset owner sk for data chunks on out queues
> when migrating a sock") made a mistake that using 'list' as the param of
> list_for_each_entry to traverse the retransmit, sacked and abandoned
> queues, while chunks are using 'transmitted_list' to link into these
> queues.
> 
> It could cause NULL dereference panic if there are chunks in any of these
> queues when peeling off one asoc.
> 
> So use the chunk member 'transmitted_list' instead in this patch.
> 
> Fixes: d04adf1b3551 ("sctp: reset owner sk for data chunks on out queues when migrating a sock")
> Signed-off-by: Xin Long <lucien.xin@gmail.com>

Applied and queued up for -stable.

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

end of thread, other threads:[~2017-11-28 20:56 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-26 12:56 [PATCH net] sctp: use right member as the param of list_for_each_entry Xin Long
2017-11-26 12:56 ` Xin Long
2017-11-27 12:45 ` Marcelo Ricardo Leitner
2017-11-27 12:45   ` Marcelo Ricardo Leitner
2017-11-27 14:04 ` Neil Horman
2017-11-27 14:04   ` Neil Horman
2017-11-28 20:56 ` David Miller
2017-11-28 20:56   ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.