X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=net%2Fsmc%2Faf_smc.c;h=3d8219e3b02649da1a45c592b26222b7122c0276;hb=724c50cac0d5063ab514fd7ea41e57ba4e093d10;hp=4f1fa1bcb0316584a0267c20b144a2e44b073e8e;hpb=f7fc72a508cf115c273a7a29350069def1041890;p=platform%2Fkernel%2Flinux-rpi.git diff --git a/net/smc/af_smc.c b/net/smc/af_smc.c index 4f1fa1b..3d8219e 100644 --- a/net/smc/af_smc.c +++ b/net/smc/af_smc.c @@ -2154,8 +2154,10 @@ static __poll_t smc_poll(struct file *file, struct socket *sock, static int smc_shutdown(struct socket *sock, int how) { struct sock *sk = sock->sk; + bool do_shutdown = true; struct smc_sock *smc; int rc = -EINVAL; + int old_state; int rc1 = 0; smc = smc_sk(sk); @@ -2182,7 +2184,11 @@ static int smc_shutdown(struct socket *sock, int how) } switch (how) { case SHUT_RDWR: /* shutdown in both directions */ + old_state = sk->sk_state; rc = smc_close_active(smc); + if (old_state == SMC_ACTIVE && + sk->sk_state == SMC_PEERCLOSEWAIT1) + do_shutdown = false; break; case SHUT_WR: rc = smc_close_shutdown_write(smc); @@ -2192,7 +2198,7 @@ static int smc_shutdown(struct socket *sock, int how) /* nothing more to do because peer is not involved */ break; } - if (smc->clcsock) + if (do_shutdown && smc->clcsock) rc1 = kernel_sock_shutdown(smc->clcsock, how); /* map sock_shutdown_cmd constants to sk_shutdown value range */ sk->sk_shutdown |= how + 1;