Linux s390 Architecture development
 help / color / mirror / Atom feed
From: Simon Horman <horms@kernel.org>
To: Hidayath Khan <hidayath@linux.ibm.com>
Cc: alibuda@linux.alibaba.com, dust.li@linux.alibaba.com,
	sidraya@linux.ibm.com, mjambigi@linux.ibm.com,
	andrew+netdev@lunn.ch, tonylu@linux.alibaba.com,
	guwen@linux.alibaba.com, davem@davemloft.net,
	edumazet@google.com, kuba@kernel.org, pabeni@redhat.com,
	pasic@linux.ibm.com, linux-s390@vger.kernel.org,
	netdev@vger.kernel.org, linux-rdma@vger.kernel.org
Subject: Re: [PATCH net v2 0/2] net/smc: fix use-after-free in smc_rx_pipe_buf_release()
Date: Mon, 24 Aug 2026 11:30:20 +0100	[thread overview]
Message-ID: <20260824103020.GN265046@horms.kernel.org> (raw)
In-Reply-To: <20260820074642.966856-1-hidayath@linux.ibm.com>

On Thu, Aug 20, 2026 at 09:46:40AM +0200, Hidayath Khan wrote:
> smc_rx_pipe_buf_release() tests sk_state before taking the socket lock
> and then dereferences conn->rmb_desc and conn->lgr. A concurrent close
> runs smc_conn_free() in between, which releases those structures. On the
> is_reg_err path smcr_buf_unuse() frees the descriptor outright, so this
> is a use-after-free.
> 
> Patch 2/2 fixes this by taking the socket lock first and testing
> conn->freed instead. smc_conn_free() sets that flag before releasing
> anything, under the same lock, so the two paths exclude each other.
> 
> Patch 1/2 is a prerequisite. conn->freed shares a byte with killed and
> out_of_sync as single-bit bitfields. out_of_sync is written from the
> receive tasklet without the socket lock, so a concurrent store to freed
> from process context can be lost in the read-modify-write. Patch 1/2
> gives each flag its own byte so stores do not interfere.
> 
> Hidayath Khan (2):
>   net/smc: stop killed, freed and out_of_sync sharing a byte
>   net/smc: fix use-after-free in smc_rx_pipe_buf_release()
> 
>  net/smc/smc.h    |  6 +++---
>  net/smc/smc_rx.c | 11 +++++------
>  2 files changed, 8 insertions(+), 9 deletions(-)
> 
> ---
> v2:
> - Patch 1/2 is new. It is a prerequisite for 2/2.
> - Patch 2/2 replaces the conn->rmb_desc = NULL approach from v1 with a
>   conn->freed check. The NULL store exposed smc_cdc_msg_recv_action()
>   and the sock_diag dump to NULL dereferences on paths that do not take
>   the socket lock.

Thanks for the updates.

The AI-generated reviews provided by sashiko-bot elsewhere in this
thread appear to relate to pre-existing issues that I don't believe
should impact the progress of this patch.

For the series:
Reviewed-by: Simon Horman <horms@kernel.org>


  parent reply	other threads:[~2026-08-24 10:30 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-20  7:46 [PATCH net v2 0/2] net/smc: fix use-after-free in smc_rx_pipe_buf_release() Hidayath Khan
2026-08-20  7:46 ` [PATCH net v2 1/2] net/smc: stop killed, freed and out_of_sync sharing a byte Hidayath Khan
2026-08-21  7:47   ` sashiko-bot
2026-08-20  7:46 ` [PATCH net v2 2/2] net/smc: fix use-after-free in smc_rx_pipe_buf_release() Hidayath Khan
2026-08-21  7:47   ` sashiko-bot
2026-08-24 10:30 ` Simon Horman [this message]
2026-08-24 19:00 ` [PATCH net v2 0/2] " 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=20260824103020.GN265046@horms.kernel.org \
    --to=horms@kernel.org \
    --cc=alibuda@linux.alibaba.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=dust.li@linux.alibaba.com \
    --cc=edumazet@google.com \
    --cc=guwen@linux.alibaba.com \
    --cc=hidayath@linux.ibm.com \
    --cc=kuba@kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=mjambigi@linux.ibm.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=pasic@linux.ibm.com \
    --cc=sidraya@linux.ibm.com \
    --cc=tonylu@linux.alibaba.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