From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=115.124.30.99 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== 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== 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 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) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 94AD0606A322 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key, unprotected) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.a=rsa-sha256 header.s=default header.b=i1PIEu6/ 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; 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 Date: Fri, 4 Dec 2026 10:42:20 +0800 From: Dust Li To: Mahanta Jambigi , andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, alibuda@linux.alibaba.com, sidraya@linux.ibm.com 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 Subject: Re: [PATCH net] net/smc: unmap the sg table when a DMA map coalesces entries Message-ID: Reply-To: dust.li@linux.alibaba.com References: <20261203125008.2061833-1-mjambigi@linux.ibm.com> X-Mailing-List: netdev@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; charset=us-ascii Content-Disposition: inline In-Reply-To: <20261203125008.2061833-1-mjambigi@linux.ibm.com> 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 >--- > 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