mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-11-30 15:53:22 -05:00
net/smc: Keep smc_close_final rc during active close
commit 00e158fb91dfaff3f94746f260d11f1a4853506e upstream. When smc_close_final() returns error, the return code overwrites by kernel_sock_shutdown() in smc_close_active(). The return code of smc_close_final() is more important than kernel_sock_shutdown(), and it will pass to userspace directly. Fix it by keeping both return codes, if smc_close_final() raises an error, return it or kernel_sock_shutdown()'s. Link: https://lore.kernel.org/linux-s390/[email protected]/ Fixes: 606a63c9783a ("net/smc: Ensure the active closing peer first closes clcsock") Suggested-by: Karsten Graul <[email protected]> Signed-off-by: Tony Lu <[email protected]> Reviewed-by: Wen Gu <[email protected]> Acked-by: Karsten Graul <[email protected]> Signed-off-by: David S. Miller <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
This commit is contained in:
parent
3f2a23fd13
commit
10bad5a197
1 changed files with 6 additions and 2 deletions
|
|
@ -183,6 +183,7 @@ int smc_close_active(struct smc_sock *smc)
|
|||
int old_state;
|
||||
long timeout;
|
||||
int rc = 0;
|
||||
int rc1 = 0;
|
||||
|
||||
timeout = current->flags & PF_EXITING ?
|
||||
0 : sock_flag(sk, SOCK_LINGER) ?
|
||||
|
|
@ -222,8 +223,11 @@ again:
|
|||
/* actively shutdown clcsock before peer close it,
|
||||
* prevent peer from entering TIME_WAIT state.
|
||||
*/
|
||||
if (smc->clcsock && smc->clcsock->sk)
|
||||
rc = kernel_sock_shutdown(smc->clcsock, SHUT_RDWR);
|
||||
if (smc->clcsock && smc->clcsock->sk) {
|
||||
rc1 = kernel_sock_shutdown(smc->clcsock,
|
||||
SHUT_RDWR);
|
||||
rc = rc ? rc : rc1;
|
||||
}
|
||||
} else {
|
||||
/* peer event has changed the state */
|
||||
goto again;
|
||||
|
|
|
|||
Loading…
Reference in a new issue