From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=143.255.12.172 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796130724; b=aPfDTABMq5U3lcZVL0T9kOyyVqYrkW4E035ewog1RC/wOJCsFFDuBLGeUBklhT1XHUxD m7MN1l79jnbqcfSoVML9Wzfa2RUyBK8jTJLUFbDltA/RexdJd+tHyagr4KoiZHpSSNrDp iGY8WGLw0coyt7kXDzXCxoMDyqRDDdqZDWlxAla4I6JEcGgPUI2eZcvHV31M5VwDdmBAq 0XUEAv791NDFE/I+GueqX8XsSr+r3yjnGalBUAhMt6kfI7D5tcexLsl4cLVyACGlZXXGE B9moPAMqRhrzNT6566sBlYnXW7rJ1pMtKGHQFjVVGSIBUMaD3ZSAOJQTzVRRw9xtYdg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796130724; h=DMARC-Filter:DKIM-Signature:Received:Message-ID:From:To:Cc:Subject: In-Reply-To:References:Date:MIME-Version:Content-Type; bh=3Cm9ATdQV6V2BbXwWk7yYSdWCE7M/6PmzLqwr+Ey3wo=; b=QVVyT2FOSkmY+L6K9VSc4FpsSf7nyxp1JrK1qmXBP82XZkx5pPRhZdtATWCE4Y0SxtKM xt5E/Vktzn4nPeVM4CsdBaN4kuAgRJj/yF45yzM2Dn0goIDn7nIMJU2JeKvkcfz/BN8Qa mOHmVLHRb6tQAY1MATY6gcG1ebdFf0ZCwIUwXhKUn1sArf//jysf4ca5uk0l6T5u0z1Kl 6qCBXut7P60HN++dwIRly4Z5gmPME9rn5iaI4EeWitQSgRa2TOXZ0c1kGMlgOtt8XaY76 CAyj9IAEJSghGjkdPkktlhKwzjPgZkxNgZ4FD1R38FCuOmqoyr8a+KAiCmTNA4hbf3w== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=manguebit.org; spf=pass smtp.mailfrom=manguebit.org; dkim=pass header.d=manguebit.org header.i=@manguebit.org header.a=rsa-sha256 header.s=dkim header.b=pql9IdkM; arc=none smtp.remote-ip=143.255.12.172 Received: from mx1.manguebit.org (mx1.manguebit.org [143.255.12.172]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 94FB0606A33A; Tue, 1 Dec 2026 13:12:01 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 94FB0606A33A Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=manguebit.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=manguebit.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=manguebit.org header.i=@manguebit.org header.a=rsa-sha256 header.s=dkim header.b=pql9IdkM DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=manguebit.org; s=dkim; h=Content-Type:MIME-Version:Date:References: In-Reply-To:Subject:Cc:To:From:Message-ID:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=3Cm9ATdQV6V2BbXwWk7yYSdWCE7M/6PmzLqwr+Ey3wo=; b=pql9IdkMuLOgofbnLlzt1MxQbZ DerpawPfiOOoyW5hzwwmpxub85U/YxjS9mnJNmZS7hdgJ5cvZLasxjXTFc8B3MCFrZrzneVGm6h4d gF6qXP4VM01epYIp4I9Z5fablZ9V/D37V17RaYtrumWKUG1EGVNnkQvsEb/Fhbzl3ibwt+zyV+8aw QVUqN4Ty4MCj37QTT0qzgzuyo6sjkdyshbyoBunqCyLwtYDHb03XrtXiiYzNT3gxrpG1/VJavmrfY R/jb5mYBR+uveGdYh1xe0OUiov53q6Ys8n3CSfan5qgKPr37zrxtVOxY0okx6K1OXqmA0USqkC+7l 7NqlTzGQ==; Received: from pc by mx1.manguebit.org with local (Exim 4.100.1) id 1xYNeF-00000001NyZ-2BQx; Tue, 01 Dec 2026 10:11:55 -0300 Message-ID: <9546f9c8b4f1e4af79aba98c136d01ee@manguebit.org> From: Paulo Alcantara To: Stefan Metzmacher , Namjae Jeon Cc: metze@samba.org, Ronnie Sahlberg , Shyam Prasad N , Tom Talpey , Bharath SM , David Howells , Tatyana Nikolova , Jacob Moroni , 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 In-Reply-To: References: Date: Tue, 01 Dec 2026 10:11:55 -0300 X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain Stefan Metzmacher 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