public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
From: Alexandra Winter <wintera@linux.ibm.com>
To: Wen Gu <guwen@linux.alibaba.com>,
	wenjia@linux.ibm.com, jaka@linux.ibm.com, davem@davemloft.net,
	edumazet@google.com, kuba@kernel.org, pabeni@redhat.com
Cc: alibuda@linux.alibaba.com, tonylu@linux.alibaba.com,
	horms@kernel.org, kgraul@linux.ibm.com, hwippel@linux.ibm.com,
	linux-rdma@vger.kernel.org, linux-s390@vger.kernel.org,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net v2 2/2] net/smc: fix LGR and link use-after-free issue
Date: Fri, 29 Nov 2024 14:28:37 +0100	[thread overview]
Message-ID: <227ce73e-a4f9-4b97-a137-f3a6472bf07f@linux.ibm.com> (raw)
In-Reply-To: <20241127133014.100509-3-guwen@linux.alibaba.com>



On 27.11.24 14:30, Wen Gu wrote:
>  net/smc/af_smc.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/net/smc/af_smc.c b/net/smc/af_smc.c
> index ed6d4d520bc7..9e6c69d18581 100644
> --- a/net/smc/af_smc.c
> +++ b/net/smc/af_smc.c
> @@ -1900,6 +1900,7 @@ static void smc_listen_out(struct smc_sock *new_smc)
>  	if (tcp_sk(new_smc->clcsock->sk)->syn_smc)
>  		atomic_dec(&lsmc->queued_smc_hs);
>  
> +	release_sock(newsmcsk); /* lock in smc_listen_work() */
>  	if (lsmc->sk.sk_state == SMC_LISTEN) {
>  		lock_sock_nested(&lsmc->sk, SINGLE_DEPTH_NESTING);
>  		smc_accept_enqueue(&lsmc->sk, newsmcsk);
> @@ -2421,6 +2422,7 @@ static void smc_listen_work(struct work_struct *work)
>  	u8 accept_version;
>  	int rc = 0;
>  
> +	lock_sock(&new_smc->sk); /* release in smc_listen_out() */
>  	if (new_smc->listen_smc->sk.sk_state != SMC_LISTEN)
>  		return smc_listen_out_err(new_smc);
>  

As far as I can tell, this looks good to me.
Unfortunately I don't understand the dependencies between the different SMC sockets and TCP sockets
well enough to give an R-b.

  reply	other threads:[~2024-11-29 13:29 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-27 13:30 [PATCH net v2 0/2] two fixes for SMC Wen Gu
2024-11-27 13:30 ` [PATCH net v2 1/2] net/smc: initialize close_work early to avoid warning Wen Gu
2024-11-27 13:30 ` [PATCH net v2 2/2] net/smc: fix LGR and link use-after-free issue Wen Gu
2024-11-29 13:28   ` Alexandra Winter [this message]
2024-11-29 17:00   ` Wenjia Zhang
2024-12-03  9:59 ` [PATCH net v2 0/2] two fixes for SMC patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=227ce73e-a4f9-4b97-a137-f3a6472bf07f@linux.ibm.com \
    --to=wintera@linux.ibm.com \
    --cc=alibuda@linux.alibaba.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=guwen@linux.alibaba.com \
    --cc=horms@kernel.org \
    --cc=hwippel@linux.ibm.com \
    --cc=jaka@linux.ibm.com \
    --cc=kgraul@linux.ibm.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=tonylu@linux.alibaba.com \
    --cc=wenjia@linux.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox