🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #26685

Re: [PATCH net] net/smc: unmap the sg table when a DMA map coalesces entries

#26685
From: Dust Li
Date: Fri, 04 Dec 2026 02:42
34 lines
9751 bytes
On 2026-12-03 13:50:08, Mahanta Jambigi wrote:
>When a device coalesces the entries of a virtually contiguous buffer,
>ib_dma_map_sg() maps fewer entries than requested and
>smcr_buf_map_link() gives up with -EAGAIN. The error path frees the sg
>table without unmapping it, so the DMA mapping is leaked.
>
>Take the existing buf_unmap path, which unmaps the sg table before
>freeing it.
>
>Fixes: b8d199451c99 ("net/smc: Allow virtually contiguous sndbufs or RMBs for SMC-R")
>Signed-off-by: Mahanta Jambigi <mjambigi@linux.ibm.com>
>---
> net/smc/smc_core.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
>diff --git a/net/smc/smc_core.c b/net/smc/smc_core.c
>index a3164201c142..0561ef81102d 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 *buf_desc, bool is_rmb,
> 	/* SMC protocol depends on mapping to one DMA address only */
> 	if (rc != nents) {
> 		rc = -EAGAIN;
>-		goto free_table;
>+		goto buf_unmap;
> 	}

Good catch! I think we should handle the error inside
smc_ib_buf_map_sg() and clean up on failure so callers don't have to
worry about those details.

Best regards,
Dust
Technical Details
Message-ID: <axIojJfevGEol4BB@linux.alibaba.com>
Path: mbox-mo1.pugleaf.net!feed-eu-txt.newsdeef.eu!feed-eu-ch.newsdeef.eu!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-377001-linux-kernel-netdev=dewy.ru
References: <20261203125008.2061833-1-mjambigi@linux.ibm.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!feed-eu-txt.newsdeef.eu!feed-eu-ch.newsdeef.eu!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-377001-linux-kernel-netdev=dewy.ru
From: dust.li@linux.alibaba.com (Dust Li)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net] net/smc: unmap the sg table when a DMA map coalesces
 entries
Date: Fri, 4 Dec 2026 10:42:20 +0800
Organization: Usenet Network
Message-ID: <axIojJfevGEol4BB@linux.alibaba.com>
References: <20261203125008.2061833-1-mjambigi@linux.ibm.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: usenet.network;
	logging-data="2658350"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:Dloemex5YzkIuu2aBK4Lkq5NBj8= sha256:TCzLkwXyMw2s3RhnLirKLNnrUiLmYncVcp7X4LFfBvI=
	sha1:zCBbapa8HqrqYEM21KXfI5FPjw8= sha256:PTKJjeiEedRf/m7aqcJhhpMFm62z4An43rdrCZXoQ+c=
Content-Disposition: inline
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id 19600117ACB; Fri,  4 Dec 2026 05:42:45 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -10.798
X-Spam-Status: No, score=-10.798 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
	DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.001,
	MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
	SPF_PASS=-0.001, UNPARSEABLE_RELAY=0.001, USER_IN_DEF_DKIM_WL=-7.5]
	autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (1024-bit key)
	header.d=linux.alibaba.com
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id lvhG3jutrstX;
	Fri,  4 Dec 2026 05:42:39 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-377001-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=linux.alibaba.com
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id 9519B11512A; Fri,  4 Dec 2026 05:42:30 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sea.lore.kernel.org (Postfix) with ESMTP id 7124927B56; Fri,  4 Dec 2026 02:42:28 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1796352148;
	b=lQ77+2uUK7X3WT8+UGK3XnDC1GDgYjY3VKYlLuoyn4YNbw0CX/ygVi2Zlx3QbxG6BUlG
	 fXMIs4RLxwYWDOfEi2Py1QD0H4Jb9f7Ff26ycGXXRKTKNqy7R777K6x2IFVMonlEvsmPb
	 YeJdkvt+eAX4fRGtIMysmaSPqKxHR+sU55IfMfj9mRiuTjKOp8j2g+U1eo3kCaPQc6CIK
	 9VrQVBoZQdArKayHxpwv6VCojWJnY5XLZxLzSZpdhl15nf4RmIhlwnW/rXltX0PKehcPz
	 biT9tXZm/S31u+2HrBPjEF1zIyL1OfURj2eyYdMiZggAcu2vKQlH8UJUiP5T/8sbYGQ==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796352148;
	h=X-Original-To:Received:DMARC-Filter:DKIM-Signature:
	 X-Alimail-AntiSpam:Received:Date:From:To:Cc:Subject:Message-ID:
	 Reply-To:References:X-Mailing-List:List-Id:List-Post:List-Help:
	 List-Subscribe:List-Unsubscribe:List-Owner:Precedence:MIME-Version:
	 Content-Type:Content-Disposition:In-Reply-To;
	bh=TWBca5qSCsKrGVSfJM3ibyV16Z/Tl+H6wf4UdrJWICE=;
	b=LWWMta9BHs8isgOMxQA5ND+FTaQXj2nVX6JoZzLDbr2QYNkrhDcasSWeSVr+4OGV4HST
	 Lxv6OOfbQd5OcjpuW0pq9CV5lKrYW5BE1Kg32SzNz/YfmUZ+gRgqzduB+thWzVJROynVW
	 g78WqU+P3Z18HYOW6VEXh1R4myK3NRv+gl5BdXkK3BW/a32/+lwxCfWsAcvbPx4F+z2hc
	 UY2SdgQ/JUrnyGowq9vm4tBdI3XMStda6OGT4Ix6ewURSyOp478Ddhr3fKBPcKe6aMmhA
	 snbN0Xy7SkBH5eV0Dc2iGcIeByFDDaSSci/nHehofsBBD4auFlkER3ROCPJNAMkMyhQ==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=linux.alibaba.com header.i=@linux.alibaba.com header.a=rsa-sha256 header.s=default header.b="i1PIEu6/";
	dmarc=pass header.from=linux.alibaba.com;
	spf=pass smtp.mailfrom=linux.alibaba.com;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id 44264606A33D;
	Fri,  4 Dec 2026 02:42:28 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.a=rsa-sha256 header.s=default header.b=i1PIEu6/
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=115.124.30.99
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1796352147;
	b=zw685puS8hYjoNVkT7oDdHbNkF98UsGwIEL6OIDRpd1loOuNw77dCra72asbVVcKTTZD
	 2famPUn9dSrsG2x6BxW90U52wEoxB8isvUAN6SApcDRg2nr4zzTpCjrGL+3CVVaXJ8q9g
	 uk8FCo8Tc/zU8gV31OVVzdKH3dM1MvnLssIdQmLwG5dIHilwkIw7bK9EcyhOUcItSOgSt
	 L1rLIKUEHyZUpnhXKFa7t79vd3l/43e3DLPP2bhicxeOt6AOGfk9OxhGtqnEaahDTybE2
	 /t5d17Jg9cnWFEwCMFWKFQv+a4z33kbNGw0Pm4HCu3HFwKChCtto7qpAFVa4FGDRVKw==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796352147;
	h=DMARC-Filter:DKIM-Signature:X-Alimail-AntiSpam:Received:Date:From:To:
	 Cc:Subject:Message-ID:Reply-To:References:MIME-Version:Content-Type:
	 Content-Disposition:In-Reply-To;
	bh=TWBca5qSCsKrGVSfJM3ibyV16Z/Tl+H6wf4UdrJWICE=;
	b=Srv11xHO7r7BHJy5us4oJaJL6gvAsRkQIsVgRD8ZIv7e1YTVlT4FL0PX88iktreu5O/w
	 HlXcB0DtDWCj3Tfs3FmlWgOxPcDQELxwrisVQf6ohlFWb8kQIsUlptQeLSKX4sHELWWcU
	 ChjfdgKdE/owB8IbOIgvSdPUEIYAlb3LyYAQyRcacEsPlfNlInxiBDhB08jlKCsrT4PQ/
	 yMmGWtb9sIuTl4T+7M7qlONa4xwNTE1grMUuwGx/ib9R534LNm9krfiws0bRaoZ0u9wtS
	 3j+JEt9iavPPFGxZlukCrfba5JkejF9v4dlwhquGYbCMfmqMFGVXoR9lUm5LsLkBHGA==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dmarc=pass header.from=linux.alibaba.com;
	spf=pass smtp.mailfrom=linux.alibaba.com;
	dkim=pass header.d=linux.alibaba.com header.i=@linux.alibaba.com header.a=rsa-sha256 header.s=default header.b="i1PIEu6/";
	arc=none smtp.remote-ip=115.124.30.99
X-Received: from out30-99.freemail.mail.aliyun.com (out30-99.freemail.mail.aliyun.com [115.124.30.99])
	(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 94AD0606A322;
	Fri,  4 Dec 2026 02:42:24 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 94AD0606A322
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.alibaba.com
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=linux.alibaba.com; s=default;
	t=1796352142; h=Date:From:To:Subject:Message-ID:MIME-Version:Content-Type;
	bh=TWBca5qSCsKrGVSfJM3ibyV16Z/Tl+H6wf4UdrJWICE=;
	b=i1PIEu6/Y60cyI2vYDlnKNvkfeP9DtgGlLMuH3+vPeBZTY9ftrt/3G77W2J/ZbsmSxSO9ruqW4eSQVOOn7R4EH29i8+dOsL5dc+Ek01HYtlJ8/+qaFXatUamXKRbX4Ch3lcgz7JYO5/gFv5xAe5APVKbQ9rXlvxMdM7SC9+PklI=
X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R111e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=maildocker-contentspam033037026112;MF=dust.li@linux.alibaba.com;NM=1;PH=DS;RN=17;SR=0;TI=SMTPD_---0XGFo1-8_1796352140;
X-Received: from localhost(mailfrom:dust.li@linux.alibaba.com fp:SMTPD_---0XGFo1-8_1796352140 cluster:ay36)
          by smtp.aliyun-inc.com;
          Fri, 04 Dec 2026 10:42:21 +0800
X-Cc: hidayath@linux.ibm.com, pasic@linux.ibm.com, horms@kernel.org,
	tonylu@linux.alibaba.com, guwen@linux.alibaba.com,
	netdev@vger.kernel.org, linux-s390@vger.kernel.org,
	linux-rdma@vger.kernel.org, stable@vger.kernel.org
X-Reply-To: dust.li@linux.alibaba.com
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list
X-In-Reply-To: <20261203125008.2061833-1-mjambigi@linux.ibm.com>