diff mbox

[net-next] sctp: change sk state to CLOSED instead of CLOSING in sctp_sock_migrate

Message ID 9229f8aa0f4324831fc31b5334cde9a258404b62.1466010906.git.lucien.xin@gmail.com
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Xin Long June 15, 2016, 5:15 p.m. UTC
Commit d46e416c11c8 ("sctp: sctp should change socket state when
shutdown is received") may set sk_state CLOSING in sctp_sock_migrate,
but inet_accept doesn't allow the sk_state other than ESTABLISHED/
CLOSED for sctp. So we will change sk_state to CLOSED, instead of
CLOSING, as actually sk is closed already there.

Fixes: commit d46e416c11c8 ("sctp: sctp should change socket state when shutdown is received")
Reported-by: Ye Xiaolong <xiaolong.ye@intel.com>
Signed-off-by: Xin Long <lucien.xin@gmail.com>
---
 net/sctp/socket.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Sergei Shtylyov June 15, 2016, 7:20 p.m. UTC | #1
Hello.

On 06/15/2016 08:15 PM, Xin Long wrote:

> Commit d46e416c11c8 ("sctp: sctp should change socket state when
> shutdown is received") may set sk_state CLOSING in sctp_sock_migrate,
> but inet_accept doesn't allow the sk_state other than ESTABLISHED/
> CLOSED for sctp. So we will change sk_state to CLOSED, instead of
> CLOSING, as actually sk is closed already there.
>
> Fixes: commit d46e416c11c8 ("sctp: sctp should change socket state when shutdown is received")

    "Commit" not needed here, this tag has well defined form.

> Reported-by: Ye Xiaolong <xiaolong.ye@intel.com>
> Signed-off-by: Xin Long <lucien.xin@gmail.com>
[...]

MBR, Sergei
David Miller June 16, 2016, 9:11 p.m. UTC | #2
From: Xin Long <lucien.xin@gmail.com>
Date: Thu, 16 Jun 2016 01:15:06 +0800

> Commit d46e416c11c8 ("sctp: sctp should change socket state when
> shutdown is received") may set sk_state CLOSING in sctp_sock_migrate,
> but inet_accept doesn't allow the sk_state other than ESTABLISHED/
> CLOSED for sctp. So we will change sk_state to CLOSED, instead of
> CLOSING, as actually sk is closed already there.
> 
> Fixes: commit d46e416c11c8 ("sctp: sctp should change socket state when shutdown is received")
> Reported-by: Ye Xiaolong <xiaolong.ye@intel.com>
> Signed-off-by: Xin Long <lucien.xin@gmail.com>

Applied.
Marcelo Ricardo Leitner June 16, 2016, 9:13 p.m. UTC | #3
On Thu, Jun 16, 2016 at 02:11:39PM -0700, David Miller wrote:
> From: Xin Long <lucien.xin@gmail.com>
> Date: Thu, 16 Jun 2016 01:15:06 +0800
> 
> > Commit d46e416c11c8 ("sctp: sctp should change socket state when
> > shutdown is received") may set sk_state CLOSING in sctp_sock_migrate,
> > but inet_accept doesn't allow the sk_state other than ESTABLISHED/
> > CLOSED for sctp. So we will change sk_state to CLOSED, instead of
> > CLOSING, as actually sk is closed already there.
> > 
> > Fixes: commit d46e416c11c8 ("sctp: sctp should change socket state when shutdown is received")
> > Reported-by: Ye Xiaolong <xiaolong.ye@intel.com>
> > Signed-off-by: Xin Long <lucien.xin@gmail.com>
> 
> Applied.

I thought Xin was going to post a version with that tag Fixed, but ok.

Patch is good to me, fwiw.
David Miller June 16, 2016, 9:26 p.m. UTC | #4
From: marcelo.leitner@gmail.com
Date: Thu, 16 Jun 2016 18:13:22 -0300

> On Thu, Jun 16, 2016 at 02:11:39PM -0700, David Miller wrote:
>> From: Xin Long <lucien.xin@gmail.com>
>> Date: Thu, 16 Jun 2016 01:15:06 +0800
>> 
>> > Commit d46e416c11c8 ("sctp: sctp should change socket state when
>> > shutdown is received") may set sk_state CLOSING in sctp_sock_migrate,
>> > but inet_accept doesn't allow the sk_state other than ESTABLISHED/
>> > CLOSED for sctp. So we will change sk_state to CLOSED, instead of
>> > CLOSING, as actually sk is closed already there.
>> > 
>> > Fixes: commit d46e416c11c8 ("sctp: sctp should change socket state when shutdown is received")
>> > Reported-by: Ye Xiaolong <xiaolong.ye@intel.com>
>> > Signed-off-by: Xin Long <lucien.xin@gmail.com>
>> 
>> Applied.
> 
> I thought Xin was going to post a version with that tag Fixed, but ok.

I fixed the tag.
diff mbox

Patch

diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index 6cae4c6..cdabbd8 100644
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -7568,7 +7568,7 @@  static void sctp_sock_migrate(struct sock *oldsk, struct sock *newsk,
 	 * is called, set RCV_SHUTDOWN flag.
 	 */
 	if (sctp_state(assoc, CLOSED) && sctp_style(newsk, TCP)) {
-		newsk->sk_state = SCTP_SS_CLOSING;
+		newsk->sk_state = SCTP_SS_CLOSED;
 		newsk->sk_shutdown |= RCV_SHUTDOWN;
 	} else {
 		newsk->sk_state = SCTP_SS_ESTABLISHED;