All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net] sctp: call iov_iter_revert() after sending ABORT
@ 2019-03-03  8:50 ` Xin Long
  0 siblings, 0 replies; 6+ messages in thread
From: Xin Long @ 2019-03-03  8:50 UTC (permalink / raw)
  To: network dev, linux-sctp; +Cc: davem, Marcelo Ricardo Leitner, Neil Horman

The user msg is also copied to the abort packet when doing SCTP_ABORT in
sctp_sendmsg_check_sflags(). When SCTP_SENDALL is set, iov_iter_revert()
should have been called for sending abort on the next asoc with copying
this msg. Otherwise, memcpy_from_msg() in sctp_make_abort_user() will
fail and return error.

Fixes: 4910280503f3 ("sctp: add support for snd flag SCTP_SENDALL process in sendmsg")
Reported-by: Ying Xu <yinxu@redhat.com>
Signed-off-by: Xin Long <lucien.xin@gmail.com>
---
 net/sctp/socket.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index 65d6d04..a2771b3 100644
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -1866,6 +1866,7 @@ static int sctp_sendmsg_check_sflags(struct sctp_association *asoc,
 
 		pr_debug("%s: aborting association:%p\n", __func__, asoc);
 		sctp_primitive_ABORT(net, asoc, chunk);
+		iov_iter_revert(&msg->msg_iter, msg_len);
 
 		return 0;
 	}
-- 
2.1.0


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

* [PATCH net] sctp: call iov_iter_revert() after sending ABORT
@ 2019-03-03  8:50 ` Xin Long
  0 siblings, 0 replies; 6+ messages in thread
From: Xin Long @ 2019-03-03  8:50 UTC (permalink / raw)
  To: network dev, linux-sctp; +Cc: davem, Marcelo Ricardo Leitner, Neil Horman

The user msg is also copied to the abort packet when doing SCTP_ABORT in
sctp_sendmsg_check_sflags(). When SCTP_SENDALL is set, iov_iter_revert()
should have been called for sending abort on the next asoc with copying
this msg. Otherwise, memcpy_from_msg() in sctp_make_abort_user() will
fail and return error.

Fixes: 4910280503f3 ("sctp: add support for snd flag SCTP_SENDALL process in sendmsg")
Reported-by: Ying Xu <yinxu@redhat.com>
Signed-off-by: Xin Long <lucien.xin@gmail.com>
---
 net/sctp/socket.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index 65d6d04..a2771b3 100644
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -1866,6 +1866,7 @@ static int sctp_sendmsg_check_sflags(struct sctp_association *asoc,
 
 		pr_debug("%s: aborting association:%p\n", __func__, asoc);
 		sctp_primitive_ABORT(net, asoc, chunk);
+		iov_iter_revert(&msg->msg_iter, msg_len);
 
 		return 0;
 	}
-- 
2.1.0

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

* Re: [PATCH net] sctp: call iov_iter_revert() after sending ABORT
  2019-03-03  8:50 ` Xin Long
@ 2019-03-04 12:09   ` Neil Horman
  -1 siblings, 0 replies; 6+ messages in thread
From: Neil Horman @ 2019-03-04 12:09 UTC (permalink / raw)
  To: Xin Long; +Cc: network dev, linux-sctp, davem, Marcelo Ricardo Leitner

On Sun, Mar 03, 2019 at 04:50:26PM +0800, Xin Long wrote:
> The user msg is also copied to the abort packet when doing SCTP_ABORT in
> sctp_sendmsg_check_sflags(). When SCTP_SENDALL is set, iov_iter_revert()
> should have been called for sending abort on the next asoc with copying
> this msg. Otherwise, memcpy_from_msg() in sctp_make_abort_user() will
> fail and return error.
> 
> Fixes: 4910280503f3 ("sctp: add support for snd flag SCTP_SENDALL process in sendmsg")
> Reported-by: Ying Xu <yinxu@redhat.com>
> Signed-off-by: Xin Long <lucien.xin@gmail.com>
> ---
>  net/sctp/socket.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/net/sctp/socket.c b/net/sctp/socket.c
> index 65d6d04..a2771b3 100644
> --- a/net/sctp/socket.c
> +++ b/net/sctp/socket.c
> @@ -1866,6 +1866,7 @@ static int sctp_sendmsg_check_sflags(struct sctp_association *asoc,
>  
>  		pr_debug("%s: aborting association:%p\n", __func__, asoc);
>  		sctp_primitive_ABORT(net, asoc, chunk);
> +		iov_iter_revert(&msg->msg_iter, msg_len);
>  
>  		return 0;
>  	}
> -- 
> 2.1.0
> 
> 
Acked-by: Neil Horman <nhorman@tuxdriver.com>

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

* Re: [PATCH net] sctp: call iov_iter_revert() after sending ABORT
@ 2019-03-04 12:09   ` Neil Horman
  0 siblings, 0 replies; 6+ messages in thread
From: Neil Horman @ 2019-03-04 12:09 UTC (permalink / raw)
  To: Xin Long; +Cc: network dev, linux-sctp, davem, Marcelo Ricardo Leitner

On Sun, Mar 03, 2019 at 04:50:26PM +0800, Xin Long wrote:
> The user msg is also copied to the abort packet when doing SCTP_ABORT in
> sctp_sendmsg_check_sflags(). When SCTP_SENDALL is set, iov_iter_revert()
> should have been called for sending abort on the next asoc with copying
> this msg. Otherwise, memcpy_from_msg() in sctp_make_abort_user() will
> fail and return error.
> 
> Fixes: 4910280503f3 ("sctp: add support for snd flag SCTP_SENDALL process in sendmsg")
> Reported-by: Ying Xu <yinxu@redhat.com>
> Signed-off-by: Xin Long <lucien.xin@gmail.com>
> ---
>  net/sctp/socket.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/net/sctp/socket.c b/net/sctp/socket.c
> index 65d6d04..a2771b3 100644
> --- a/net/sctp/socket.c
> +++ b/net/sctp/socket.c
> @@ -1866,6 +1866,7 @@ static int sctp_sendmsg_check_sflags(struct sctp_association *asoc,
>  
>  		pr_debug("%s: aborting association:%p\n", __func__, asoc);
>  		sctp_primitive_ABORT(net, asoc, chunk);
> +		iov_iter_revert(&msg->msg_iter, msg_len);
>  
>  		return 0;
>  	}
> -- 
> 2.1.0
> 
> 
Acked-by: Neil Horman <nhorman@tuxdriver.com>

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

* Re: [PATCH net] sctp: call iov_iter_revert() after sending ABORT
  2019-03-03  8:50 ` Xin Long
@ 2019-03-04 18:59   ` David Miller
  -1 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2019-03-04 18:59 UTC (permalink / raw)
  To: lucien.xin; +Cc: netdev, linux-sctp, marcelo.leitner, nhorman

From: Xin Long <lucien.xin@gmail.com>
Date: Sun,  3 Mar 2019 16:50:26 +0800

> The user msg is also copied to the abort packet when doing SCTP_ABORT in
> sctp_sendmsg_check_sflags(). When SCTP_SENDALL is set, iov_iter_revert()
> should have been called for sending abort on the next asoc with copying
> this msg. Otherwise, memcpy_from_msg() in sctp_make_abort_user() will
> fail and return error.
> 
> Fixes: 4910280503f3 ("sctp: add support for snd flag SCTP_SENDALL process in sendmsg")
> Reported-by: Ying Xu <yinxu@redhat.com>
> Signed-off-by: Xin Long <lucien.xin@gmail.com>

Applied and queued up for -stable.

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

* Re: [PATCH net] sctp: call iov_iter_revert() after sending ABORT
@ 2019-03-04 18:59   ` David Miller
  0 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2019-03-04 18:59 UTC (permalink / raw)
  To: lucien.xin; +Cc: netdev, linux-sctp, marcelo.leitner, nhorman

From: Xin Long <lucien.xin@gmail.com>
Date: Sun,  3 Mar 2019 16:50:26 +0800

> The user msg is also copied to the abort packet when doing SCTP_ABORT in
> sctp_sendmsg_check_sflags(). When SCTP_SENDALL is set, iov_iter_revert()
> should have been called for sending abort on the next asoc with copying
> this msg. Otherwise, memcpy_from_msg() in sctp_make_abort_user() will
> fail and return error.
> 
> Fixes: 4910280503f3 ("sctp: add support for snd flag SCTP_SENDALL process in sendmsg")
> Reported-by: Ying Xu <yinxu@redhat.com>
> Signed-off-by: Xin Long <lucien.xin@gmail.com>

Applied and queued up for -stable.

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

end of thread, other threads:[~2019-03-04 18:59 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-03  8:50 [PATCH net] sctp: call iov_iter_revert() after sending ABORT Xin Long
2019-03-03  8:50 ` Xin Long
2019-03-04 12:09 ` Neil Horman
2019-03-04 12:09   ` Neil Horman
2019-03-04 18:59 ` David Miller
2019-03-04 18:59   ` 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.