From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796388802; b=cLjJkL8GvbQrrUbcbdFqLK4WOzITmNfTt7wYZDU0ETMjjIfsv4vkianca6gp4n7Nd/10 bQ1a9Gj6E732LeUDTW3i56kokK66Halz1a1SV77iuyd+Y0vgNUBsBT67/CYnlpgGCwn7p jFwb/MkRvS8S8jNy6qdNonuk1gxRDJy1sTkYR38KzLZcaDNIgyOCt6sAwQqU14levvWao xCMEevT5da6BJEeS/R3p+D+YERmUd7msmMlm910ij36dvyK7j5cDPZLB52P9vOKbzzQgf dol0UtFsILjsoLiSB+wxDQG5VMuf25oG3ZH6HQkCyV8St+6bKDRQHhbkLx5KvJ+jIgw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796388802; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=5Xuy5vUCNuZ6PM1hXGmYLheGYbQEZc12YtX8+Q9k7ps=; b=Mo+KB6eY1EG3Cm/MIIePgEBiyRCjZKU3YPEc4uUlimEddBWAZJsMMkfafDz0ZsrMiOcF pn/7OG+IQInPllc4uCnYj5mVCiLmFh1aFCHt1HXQI1RDJEtdL9XoQYBKRkKPUtKKg/Onb lc5wpVbfBSz/HFxcBNysWkcVvvi9D+HhdLa/AUQ3d/wGcGli4jdfLXHLW5zq963CH8I3Y J4yo7oS6DbaExHrV067tu1L69cMut4nnh17sZlRuDQoZluyshWl/NHRVYOP9zyqzWtakz aCwtG4aNYgZfoR79WQOT/xCxvKnfSTqiRbIjkt4ZyOxsuClqbeXlqOIYJWWbt3ezd2A== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=KBbBYwjV; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (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 E75A8606A330; Fri, 4 Dec 2026 12:53:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=KBbBYwjV Received: by smtp.kernel.org (Postfix) with ESMTPSA id 876CB1F00897; Fri, 4 Dec 2026 12:53:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796388801; bh=5Xuy5vUCNuZ6PM1hXGmYLheGYbQEZc12YtX8+Q9k7ps=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=KBbBYwjVkuNFrJQxOd902zfymicRW3diXevtX799mvPcuPOfWnIC1VLur0AGVJnbe uL1SEh8M4Nn+l47zzmNjyVQ8IJlxiVsiW2oUK58P84ODQKYimyFlI4I3D/wGM7JtIT drpTZgseDUD5LdLvQ1PtXcvke/98WoP08iYkl+ArcH5/6SYrbGXICgEjgH3RmMok/W eUcsmnMpsM61f1+8GyTaRK5fdC0BIEgJw1DpNOiYcxiYxIkcTwjmI1WrPtAYFiCDoT HW7YQUDDmMGHbVcIkDcegaRuhrHT3h5iKkBzl/1RlpRwTGt+vSgZQMhENg1qTWTT4P AicQMjxgUnaiQ== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH net] net/smc: unmap the sg table when a DMA map coalesces entries Reply-To: sashiko-reviews@lists.linux.dev To: "Mahanta Jambigi" Cc: linux-s390@vger.kernel.org, linux-rdma@vger.kernel.org, "Heiko Carstens" , "Vasily Gorbik" , "Alexander Gordeev" , "Christian Borntraeger" In-Reply-To: <20261203125008.2061833-1-mjambigi@linux.ibm.com> References: <20261203125008.2061833-1-mjambigi@linux.ibm.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Fri, 04 Dec 2026 12:53:21 +0000 X-Mailing-List: linux-s390@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found 2 potential issues to consider: - [High] net/smc: smcr_buf_map_link() unmaps sg table on DMA mapping failure - [Medium] net/smc: unused free_table label in smcr_buf_map_link() breaks build -- commit 9210b3d201b780d3ddbcb843ac69fe3f41a1f09e Author: Mahanta Jambigi net/smc: unmap the sg table when a DMA map coalesces entries This commit changes the rc !=3D nents error path in smcr_buf_map_link() to jump to buf_unmap instead of free_table so that coalesced sg mappings are unmapped before freeing the sg table. > diff --git a/net/smc/smc_core.c b/net/smc/smc_core.c > index a3164201c1420..0561ef81102d9 100644 > --- a/net/smc/smc_core.c > +++ b/net/smc/smc_core.c > @@ -2226,7 +2226,7 @@ static int smcr_buf_map_link(struct smc_buf_desc *b= uf_desc, bool is_rmb, > /* SMC protocol depends on mapping to one DMA address only */ > if (rc !=3D nents) { > rc =3D -EAGAIN; > - goto free_table; > + goto buf_unmap; > } > =20 > buf_desc->is_dma_need_sync |=3D [Severity: High] Does this call smc_ib_buf_unmap_sg() on an unmapped scatterlist when ib_dma_map_sg() fails? smc_ib_buf_map_sg() returns -ENOMEM when ib_dma_map_sg() fails, which also takes the rc !=3D nents branch. smc_ib_buf_unmap_sg() only skips unmapping when sgl->dma_address is 0, but iommu_dma_map_sg() and dma_direct_map_sg() leave DMA_MAPPING_ERROR or rolled-back addresses. Calling ib_dma_unmap_sg() on that scatterlist violates the DMA API, triggering CONFIG_DMA_API_DEBUG errors and double-unmapping SWIOTLB slots or IOVAs. Jumping to free_table when rc < 0 and only to buf_unmap when rc > 0 avoids unmapping a failed mapping. [Severity: Medium] Will removing the only jump to free_table leave an unused label in smcr_buf_map_link()? With -Wall enabled in kernel builds, this triggers a -Wunused-label warning and fails compilation under CONFIG_WERROR=3Dy. Keeping the free_table target for the rc < 0 path above resolves this as well. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261203125008.2061= 833-1-mjambigi@linux.ibm.com?part=3D1