smc: fix sendpage() call
authorStefan Raspl <stefan.raspl@linux.ibm.com>
Thu, 3 May 2018 15:57:39 +0000 (17:57 +0200)
committerDavid S. Miller <davem@davemloft.net>
Thu, 3 May 2018 18:47:31 +0000 (14:47 -0400)
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>
net/smc/af_smc.c

index d03b8d29ffc05896ecc0beff941f97263e5c35a9..544bab42f925a1eb90ac537a1eee7398e92a7c9f 100644 (file)
@@ -1315,8 +1315,11 @@ static ssize_t smc_sendpage(struct socket *sock, struct page *page,
 
        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);
@@ -1324,7 +1327,6 @@ static ssize_t smc_sendpage(struct socket *sock, struct page *page,
                rc = sock_no_sendpage(sock, page, offset, size, flags);
 
 out:
-       release_sock(sk);
        return rc;
 }