From: Paulo Alcantara <pc@manguebit.org>
To: Stefan Metzmacher <metze@samba.org>, Namjae Jeon <linkinjeon@kernel.org>
Cc: metze@samba.org, Ronnie Sahlberg <ronniesahlberg@gmail.com>,
Shyam Prasad N <sprasad@microsoft.com>,
Tom Talpey <tom@talpey.com>, Bharath SM <bharathsm@microsoft.com>,
David Howells <dhowells@redhat.com>,
Tatyana Nikolova <tatyana.e.nikolova@intel.com>,
Jacob Moroni <jmoroni@google.com>,
linux-cifs@vger.kernel.org, linux-rdma@vger.kernel.org,
samba-technical@lists.samba.org, stable@vger.kernel.org
Subject: Re: [PATCH v5 00/20] smb: smbdirect: urgent fixes for teardown races, sends and MR invalidation
Date: Tue, 01 Dec 2026 10:11:55 -0300 [thread overview]
Message-ID: <9546f9c8b4f1e4af79aba98c136d01ee@manguebit.org> (raw)
In-Reply-To: <cover.1796077472.git.metze@samba.org>
Stefan Metzmacher <metze@samba.org> writes:
> these are fixes for fs/smb/smbdirect:
>
> - Don't register MRs or post sends on a connection that is being
> torn down concurrently (NULL pointer dereferences of mr->mr and
> sc->ib.qp, reported by Sashiko).
>
> - Handle errors of smbdirect_iter_to_sgt(), an incomplete sg table
> was registered before.
>
> - A send credit leaked if the wait for a recv credit to grant
> failed, so all following sends waited until the connection was
> torn down.
>
> - After an error in the middle of a PDU, the fragments built so far
> were still posted, so the peer appended the next PDU to the
> incomplete one. Now the connection is torn down instead, also
> for smbd_send() of the client.
>
> - If the peer didn't invalidate a remotely invalidated MR, e.g.
> because of an error in the server, the client also skipped the
> local invalidation, so the peer kept access to the memory.
> smbdirect now tracks the remote invalidations itself.
>
> - The LOCAL_INV of an MR reused the cqe of the REG_MR and
> overwrote its done handler, so a not yet polled REG_MR completion
> finished the invalidation too early and the MR went back to the
> ready list while the LOCAL_INV was still outstanding. Now the
> LOCAL_INV has its own cqe.
>
> - INIT_[DELAYED_]WORK() in the connect and accept code reset the
> disable count of the work items, so a disable from a concurrent
> teardown was lost and e.g. the idle timer could be queued again
> after the socket was freed. Now the teardown sets first_error
> and disables the work items under a new lock and they are only
> activated under that lock while first_error is still 0.
>
> - SMBDIRECT_CHECK_STATUS_{WARN,DISCONNECT}() warned about a status
> changed by a concurrent teardown, e.g. when the waiter of a
> connect was interrupted by a signal (reported by syzbot).
>
> - An IB_WR_REG_MR or IB_WR_LOCAL_INV posted after a status check
> that raced with smbdirect_socket_destroy() could miss the drain
> of the QP, its completion then used the mr after it was detached
> from the socket (reported by Sashiko).
>
> - The error paths of smbdirect_connection_send_single_iter() gave
> back credits without waking up the waiters and didn't give back
> the receive credits granted in the message that wasn't sent
> (reported by Sashiko).
>
> - The connect and accept code checked the status and then set the
> status of the next step, a concurrent teardown in between was
> overwritten, so rdma_disconnect() could be skipped and
> rdma_accept() was called for a socket being torn down. A listener
> being torn down could still accept new connections (reported by
> Sashiko).
>
> - The DMA address of the first page was used as iova of our MRs and
> sent to the peer as offset of the buffer descriptor, without an
> IOMMU these are physical addresses. Now only the offset within
> the first page is kept in the low 24 bits, the bits above up to
> bit 55 are random and the top byte stays 0. This also avoids irdma
> rejecting an MR ending exactly at 2^64 (IRDMA_AE_AMP_TO_WRAP),
> which happens with an IOMMU allocating the first 64-bit IOVA
> range at the very top.
>
> - If the connection was torn down while an IB_WR_REG_MR was still
> pending, deregistering the mr didn't wait for it, so mr->mr was
> deregistered and the pages unmapped before the QP was drained
> (reported by Sashiko).
>
> - The backlog of a listener was only set after rdma_listen()
> returned, so early connect requests ignored the backlog and if
> rdma_listen() failed for a later device, the cleanup skipped the
> child sockets and the listener was freed without RCU (reported by
> Sashiko).
>
> - Concurrent teardowns changed the status without a lock, so it
> could move backwards, e.g. from SMBDIRECT_SOCKET_DISCONNECTED to
> SMBDIRECT_SOCKET_ERROR (reported by Sashiko).
>
> - smbdirect_socket_accept() changed the status of a ready socket
> without the lock of that socket, so it could hand out a socket whose
> teardown had just started (reported by Sashiko).
>
> - A teardown racing with the connection setup triggered a spurious
> WARN_ON_ONCE(!recv_io) (reported by Sashiko).
Reviewed-by: Paulo Alcantara <pc@manguebit.org>
prev parent reply other threads:[~2026-12-01 13:12 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-30 22:28 [PATCH v5 00/20] smb: smbdirect: urgent fixes for teardown races, sends and MR invalidation Stefan Metzmacher
2026-11-30 22:28 ` [PATCH v5 01/20] smb: smbdirect: don't register MRs on a torn-down connection Stefan Metzmacher
2026-11-30 22:28 ` [PATCH v5 02/20] smb: smbdirect: don't post sends " Stefan Metzmacher
2026-11-30 22:29 ` [PATCH v5 03/20] smb: smbdirect: handle errors from smbdirect_iter_to_sgt() Stefan Metzmacher
2026-11-30 22:29 ` [PATCH v5 04/20] smb: smbdirect: give back the send credit if waiting for a recv credit fails Stefan Metzmacher
2026-11-30 22:29 ` [PATCH v5 05/20] smb: smbdirect: don't post a partial PDU after a send error Stefan Metzmacher
2026-11-30 22:29 ` [PATCH v5 06/20] smb: smbdirect: introduce smbdirect_connection_invalidate_rkey() and its logic Stefan Metzmacher
2026-11-30 22:29 ` [PATCH v5 07/20] smb: smbdirect: use separate cqes for MR registration and invalidation Stefan Metzmacher
2026-11-30 22:29 ` [PATCH v5 08/20] smb: smbdirect: don't let INIT_[DELAYED_]WORK() undo a disable from the teardown Stefan Metzmacher
2026-11-30 22:29 ` [PATCH v5 09/20] smb: smbdirect: don't warn about a status changed by a concurrent teardown Stefan Metzmacher
2026-11-30 22:29 ` [PATCH v5 10/20] smb: smbdirect: don't expose DMA addresses as iova of our MRs Stefan Metzmacher
2026-11-30 22:29 ` [PATCH v5 11/20] smb: smbdirect: don't let MR work requests miss the QP drain Stefan Metzmacher
2026-11-30 22:29 ` [PATCH v5 12/20] smb: smbdirect: wake up the credit waiters after a failed send Stefan Metzmacher
2026-11-30 22:29 ` [PATCH v5 13/20] smb: smbdirect: give back granted receive credits if a send fails Stefan Metzmacher
2026-11-30 22:29 ` [PATCH v5 14/20] smb: smbdirect: don't let the connection setup overwrite a teardown status Stefan Metzmacher
2026-11-30 22:29 ` [PATCH v5 15/20] smb: smbdirect: use the socket argument in __SMBDIRECT_CHECK_STATUS_WARN() Stefan Metzmacher
2026-11-30 22:29 ` [PATCH v5 16/20] smb: smbdirect: don't accept new connections on a listener being torn down Stefan Metzmacher
2026-11-30 22:29 ` [PATCH v5 17/20] smb: smbdirect: don't deregister an MR before its registration completed Stefan Metzmacher
2026-11-30 22:29 ` [PATCH v5 18/20] smb: smbdirect: set the listen backlog before calling rdma_listen() Stefan Metzmacher
2026-11-30 22:29 ` [PATCH v5 19/20] smb: smbdirect: don't let concurrent teardowns move the status backwards Stefan Metzmacher
2026-11-30 22:29 ` [PATCH v5 20/20] smb: smbdirect: don't warn if a teardown races with the connection setup Stefan Metzmacher
2026-11-30 22:50 ` [PATCH v5 00/20] smb: smbdirect: urgent fixes for teardown races, sends and MR invalidation sashiko-bot
2026-12-01 11:06 ` Namjae Jeon
2026-12-01 13:11 ` Paulo Alcantara [this message]
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=9546f9c8b4f1e4af79aba98c136d01ee@manguebit.org \
--to=pc@manguebit.org \
--cc=bharathsm@microsoft.com \
--cc=dhowells@redhat.com \
--cc=jmoroni@google.com \
--cc=linkinjeon@kernel.org \
--cc=linux-cifs@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=metze@samba.org \
--cc=ronniesahlberg@gmail.com \
--cc=samba-technical@lists.samba.org \
--cc=sprasad@microsoft.com \
--cc=stable@vger.kernel.org \
--cc=tatyana.e.nikolova@intel.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.