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=1795968187; b=5hQZ3M6isSr36LD/jic93fH3FOWwVFlXVtpLRog/Q6WpNvXPWj6+7+prq/aHEALPjNuw S1bqhQO3iZRrtUDLkA0MJhbKKrOgufH/ZgS8smgD7/D9MWcM7o8zBnA5cb8ULTQZ50KDY UvsCyRKew9myebORGKdaHFxK2SXF7Dtia2Wch+y9WpEzTdqmaAFIO5CmfLYEP54bxuPYO FX9XVZ/NZp2kPz996F7z5x41gSJfJENgOfk4bwkMmq/ilCp65shN4KLb0Qf4cuu/4utMk EoJj/4KDzoDic0h+34xihOY5zANdR6lcBpUWDKIrvL3sPdTKMvVGnsOj4E7g/7qC91g== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795968187; h=DMARC-Filter:DKIM-Signature:Received:Message-ID:From:To:Cc:Subject: In-Reply-To:References:Date:MIME-Version:Content-Type; bh=et4oFVsz85C6HtMfl+HClN5DU7v0wDk9Plel6diqlko=; b=hBNKHEHNtCWpmicAtNcOBGOABJRZjvLR6/1zHpogVTBqdq+jdosFX01WFmCc+siMM2+O YtacbvZ2PV9cRXKbM3nbULDBb/vruK/xIEGMRG33mhsTKXBWzuL5Q5HlLtkBFsJbB4eT8 acqCOruwhJ0eXadOvEuXHMhWIKsmMhqWht7NnM/bXKyGTD2f87g5tAK5VS1TVtjXy2zGM sTlP9q6ht7NImxub3L1Jx+h076JKW/vNJB+B/COFSW934T3qR7g+vD02odwD9vywxcrua 2KEEVPgwIQN/ElUJ6SpWOCwv2eCfCmeZMdnNIe3U9Mr4JytLCBK5OvXT3dWPd22Ek4Q== 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=pHXtcq86; 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)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 35253606A323; Sun, 29 Nov 2026 16:03:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 35253606A323 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) header.d=manguebit.org header.i=@manguebit.org header.a=rsa-sha256 header.s=dkim header.b=pHXtcq86 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=et4oFVsz85C6HtMfl+HClN5DU7v0wDk9Plel6diqlko=; b=pHXtcq86zXMVmyK/VTuMiDC52c Ip25hcqExlASFsXiYDvU+YWWAJdfvN3xoa7UWURw+ZhcFgBPbnXdXPCdUrGxVl0kfhS8X5P0M/F77 VTpbxfDOBkrMT0NuKX6pZ94+DTafo4udZVv9Leqf206OZqELMqZ+CFnEwfb7GnItPlBTNOySYgqVE +JuzdTUg9y/5LCIFJYlBLjQfEGSAV/56Bvc2XAm3KMys/aK4rifRbRrlzGcXJLMGeoQZywsBCURrk AWlV1CaTPupp+GZkbb6qJOXVL399K+vpWFbGP8VvF0hJ99u7RTXEFuvO5gOUn2pVvBnqbn5WwuTw4 l9I8SH0g==; Received: from pc by mx1.manguebit.org with local (Exim 4.100.1) id 1xXhMn-00000001DLF-2dji; Sun, 29 Nov 2026 13:03:05 -0300 Message-ID: From: Paulo Alcantara To: Stefan Metzmacher , Namjae Jeon Cc: metze@samba.org, Ronnie Sahlberg , Shyam Prasad N , Tom Talpey , Bharath SM , linux-cifs@vger.kernel.org, samba-technical@lists.samba.org, stable@vger.kernel.org Subject: Re: [PATCH v3 00/16] smb: smbdirect: urgent fixes for teardown races, sends and MR invalidation In-Reply-To: References: Date: Sun, 29 Nov 2026 13:03:05 -0300 X-Mailing-List: linux-cifs@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: > Hi Namjae, hi Paulo, > > 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. Looks good: Reviewed-by: Paulo Alcantara