| From foo@baz Sun Jun 17 12:07:34 CEST 2018 |
| From: Stefan Raspl <stefan.raspl@linux.ibm.com> |
| Date: Thu, 3 May 2018 17:57:39 +0200 |
| Subject: smc: fix sendpage() call |
| |
| From: Stefan Raspl <stefan.raspl@linux.ibm.com> |
| |
| [ Upstream commit bda27ff5c4526f80a7620a94ecfe8dca153e3696 ] |
| |
| The sendpage() call grabs the sock lock before calling the default |
| implementation - which tries to grab it once again. |
| |
| Signed-off-by: Stefan Raspl <raspl@linux.ibm.com> |
| Signed-off-by: Ursula Braun <ubraun@linux.ibm.com>< |
| Signed-off-by: David S. Miller <davem@davemloft.net> |
| Signed-off-by: Sasha Levin <alexander.levin@microsoft.com> |
| Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> |
| --- |
| net/smc/af_smc.c | 6 ++++-- |
| 1 file changed, 4 insertions(+), 2 deletions(-) |
| |
| --- a/net/smc/af_smc.c |
| +++ b/net/smc/af_smc.c |
| @@ -1313,8 +1313,11 @@ static ssize_t smc_sendpage(struct socke |
| |
| smc = smc_sk(sk); |
| lock_sock(sk); |
| - if (sk->sk_state != SMC_ACTIVE) |
| + if (sk->sk_state != SMC_ACTIVE) { |
| + release_sock(sk); |
| goto out; |
| + } |
| + release_sock(sk); |
| if (smc->use_fallback) |
| rc = kernel_sendpage(smc->clcsock, page, offset, |
| size, flags); |
| @@ -1322,7 +1325,6 @@ static ssize_t smc_sendpage(struct socke |
| rc = sock_no_sendpage(sock, page, offset, size, flags); |
| |
| out: |
| - release_sock(sk); |
| return rc; |
| } |
| |