All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paulo Alcantara <pc@manguebit.org>
To: Qican Ma <goonsomeway@gmail.com>, linkinjeon@kernel.org
Cc: metze@samba.org, tom@talpey.com, ronniesahlberg@gmail.com,
	sprasad@microsoft.com, bharathsm@microsoft.com,
	linux-cifs@vger.kernel.org
Subject: Re: [PATCH v2] smb: client: protect server->smbd_conn with RCU and refcounting
Date: Thu, 26 Nov 2026 12:22:08 -0300	[thread overview]
Message-ID: <6dccc6ca08e055f4c00df3596391d940@manguebit.org> (raw)
In-Reply-To: <179550686494.38773.3803244405772043954@gmail.com>

Qican Ma <goonsomeway@gmail.com> writes:

> Several paths check and dereference server->smbd_conn without holding a
> lock that serializes against smbd_destroy() during reconnect or teardown
> (including smb2_new_read_req(), smb2_async_writev(), smbd_send(),
> cifs_readv_from_socket(), cifs_prepare_read/write(),
> smb3_negotiate_r/wsize(), and smbd_debug_proc_show()). Meanwhile
> smbd_destroy() releases the underlying socket and calls kfree(info)
> before clearing server->smbd_conn = NULL, exposing a use-after-free
> window to concurrent readers.
>
> Annotate server->smbd_conn with __rcu and add a refcount and completion
> to struct smbd_connection. Readers acquire a short-lived reference via
> smbd_conn_get() under rcu_read_lock() and drop it with smbd_conn_put().
> In smbd_destroy(), clear server->smbd_conn first, shut down the socket to
> wake any blocked callers, wait for active references and an RCU grace
> period to complete, and then release the socket and free info in process
> context. Pass server directly to smbd_recv() and smbd_register_mr() so
> connection pinning stays encapsulated inside smbdirect.c.

Please check sashiko's review

        https://sashiko.dev/#/patchset/179550686494.38773.3803244405772043954%40gmail.com

  reply	other threads:[~2026-11-26 15:22 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-24  7:54 [PATCH v2] smb: client: protect server->smbd_conn with RCU and refcounting Qican Ma
2026-11-26 15:22 ` Paulo Alcantara [this message]
2026-11-26 16:13   ` Qican Ma
2026-11-26 16:33     ` Paulo Alcantara

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=6dccc6ca08e055f4c00df3596391d940@manguebit.org \
    --to=pc@manguebit.org \
    --cc=bharathsm@microsoft.com \
    --cc=goonsomeway@gmail.com \
    --cc=linkinjeon@kernel.org \
    --cc=linux-cifs@vger.kernel.org \
    --cc=metze@samba.org \
    --cc=ronniesahlberg@gmail.com \
    --cc=sprasad@microsoft.com \
    --cc=tom@talpey.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.