Re: [PATCH net 1/1] net/smc: coordinate wait queues for nonblocking connect

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jun 20, 2018 at 1:07 AM, Ursula Braun <ubraun@xxxxxxxxxxxxx> wrote:
> diff --git a/net/smc/af_smc.c b/net/smc/af_smc.c
> index da7f02edcd37..21c84b924ffb 100644
> --- a/net/smc/af_smc.c
> +++ b/net/smc/af_smc.c
> @@ -605,6 +605,8 @@ static int smc_connect(struct socket *sock, struct sockaddr *addr,
>
>         smc_copy_sock_settings_to_clc(smc);
>         tcp_sk(smc->clcsock->sk)->syn_smc = 1;
> +       if (flags & O_NONBLOCK)
> +               sock->sk->sk_wq = smc->clcsock->sk->sk_wq;
>         rc = kernel_connect(smc->clcsock, addr, alen, flags);
>         if (rc)
>                 goto out;
> @@ -1285,12 +1287,9 @@ static __poll_t smc_poll_mask(struct socket *sock, __poll_t events)
>
>         smc = smc_sk(sock->sk);
>         sock_hold(sk);
> -       lock_sock(sk);
>         if ((sk->sk_state == SMC_INIT) || smc->use_fallback) {
>                 /* delegate to CLC child sock */
> -               release_sock(sk);
>                 mask = smc->clcsock->ops->poll_mask(smc->clcsock, events);
> -               lock_sock(sk);
>                 sk->sk_err = smc->clcsock->sk->sk_err;
>                 if (sk->sk_err) {
>                         mask |= EPOLLERR;
> @@ -1299,7 +1298,10 @@ static __poll_t smc_poll_mask(struct socket *sock, __poll_t events)
>                         if (sk->sk_state == SMC_INIT &&
>                             mask & EPOLLOUT &&
>                             smc->clcsock->sk->sk_state != TCP_CLOSE) {
> +                               sock->sk->sk_wq = smc->smcwq;
> +                               lock_sock(sk);

I think you need to use proper RCU API to protect these
assignment of sk->sk_wq.
--
To unsubscribe from this list: send the line "unsubscribe linux-s390" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Kernel Development]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Info]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Linux Media]     [Device Mapper]

  Powered by Linux